美文网首页
AudioFilePropertyID

AudioFilePropertyID

作者: 执拗的男孩 | 来源:发表于2020-05-14 15:20 被阅读0次

// Audio File Properties

音频文件获取/设置属性调用的常量
@enum       Audio File Properties
@abstract   constants for AudioFile get/set property call

具体的参数

       音频文件的格式   char *
@constant   kAudioFilePropertyFileFormat 
                An AudioFileTypeID that identifies the format of the file

音频数据的格式   AudioStreamPacketDescription
@constant   kAudioFilePropertyDataFormat 
                An AudioStreamBasicDescription describing the format of the audio data

支持的格式列表 编码格式list
@constant   kAudioFilePropertyFormatList 
                In order to support formats such as AAC SBR where an encoded data stream can be decoded to 
                multiple destination formats, this property returns an array of AudioFormatListItems (see AudioFormat.h) of those formats.
                The default behavior is to return the an AudioFormatListItem that has the same AudioStreamBasicDescription 
                that kAudioFilePropertyDataFormat returns.

是否可以优化  0/1
@constant   kAudioFilePropertyIsOptimized 
                A UInt32 indicating whether an Audio File has been optimized.
                Optimized means it is ready to start having sound data written to it. 
                A value of 0 indicates the file needs to be optimized.
                A value of 1 indicates the file is currently optimized.

Magic Cookie文件头 char *
@constant   kAudioFilePropertyMagicCookieData 
                A void * pointing to memory set up by the caller.
                Some file types require that a magic cookie be provided before packets can be written
                to the file, so this property should be set before calling 
                AudioFileWriteBytes()/AudioFileWritePackets() if a magic cookie exists.

文件长度    Uint64
@constant   kAudioFilePropertyAudioDataByteCount 
                a UInt64 that indicates the number of bytes of audio data contained in the file

Packet的数目   Uint64
@constant   kAudioFilePropertyAudioDataPacketCount 
                a UInt64 that indicates the number of packets of audio data contained in the file

最大的Packet大小 Uint32
@constant   kAudioFilePropertyMaximumPacketSize 
                a UInt32 that indicates the maximum size of a packet for the data contained in the file

数据的偏移量  SInt64
@constant   kAudioFilePropertyDataOffset 
                a SInt64 that indicates the byte offset in the file of the audio data.

声道结构    AudioFormatListItem
@constant   kAudioFilePropertyChannelLayout 
                An AudioChannelLayout struct.

是否更新文件头信息   1/0
@constant   kAudioFilePropertyDeferSizeUpdates 
                A UInt32. If 1, then updating the files sizes in the header is not done for every write, 
                but deferred until the file is read, optimized or closed. This is more efficient, but less safe
                since, if the application crashes before the size is updated, the file may not be readable.
                The default value is one, it doesn't update the header.

@constant   kAudioFilePropertyDataFormatName 
                This is deprecated. Use kAudioFormatProperty_FormatName in AudioFormat.h instead.

音频中所有markers    CFStringRef表示的Markers列表
@constant   kAudioFilePropertyMarkerList 
                access the list of markers defined in the file. returns an AudioFileMarkerList.
                The CFStringRefs in the returned structs must be released by the client.
                (available in 10.2.4 and later)

音频中所有Region CFStringRef表示的Region列表
@constant   kAudioFilePropertyRegionList 
                access the list of regions defined in the file. returns an Array of AudioFileRegions.
                The CFStringRefs in the returned structs must be released by the client.
                (available in 10.2.4 and later)

将包数转换成帧数    AudioFramePacketTranslation中mPacket做输入,mFrame做输出
@constant   kAudioFilePropertyPacketToFrame 
                pass a AudioFramePacketTranslation with mPacket filled out and get mFrame back. mFrameOffsetInPacket is ignored.

将帧数转换成包数    AudioFramePacketTranslation中mFrame做输入,mFrameOffsetInPacket,mPacket做输出
@constant   kAudioFilePropertyFrameToPacket 
                pass a AudioFramePacketTranslation with mFrame filled out and get mPacket and mFrameOffsetInPacket back.
                
@constant   kAudioFilePropertyRestrictsRandomAccess
                A UInt32 indicating whether an Audio File contains packets that cannot be used as random access points.
                A value of 0 indicates that any packet can be used as a random access point, i.e. that a decoder can start decoding with any packet.
                A value of 1 indicates that some packets cannot be used as random access points, i.e. that kAudioFilePropertyPacketToRollDistance must be employed in order to identify an appropriate initial packet for decoding.
@constant   kAudioFilePropertyPacketToRollDistance
                Pass an AudioPacketRollDistanceTranslation with mPacket filled out and get mRollDistance back.
                The roll distance indicates the count of packets that must be decoded prior to the packet with the specified number in order to achieve the best practice for the decoding of that packet.
                For file types for which a minimal roll distance is prohibitively expensive to determine per packet, the value returned may be derived from an upper bound for all packet roll distances.
                If the value of kAudioFilePropertyRestrictsRandomAccess is 1, either kAudioFilePropertyPacketToRollDistance
                or kAudioFilePropertyPacketToDependencyInfo must be used in order to identify an appropriate random access point.
                If the value of kAudioFilePropertyRestrictsRandomAccess is 0, kAudioFilePropertyPacketToRollDistance can be used in
                order to identify the best available random access point, which may be prior to the specified packet even if the specified
                packet can be used as a random access point.
@constant   kAudioFilePropertyPreviousIndependentPacket
@constant   kAudioFilePropertyNextIndependentPacket
                Pass an AudioIndependentPacketTranslation with mPacket filled out and get mIndependentlyDecodablePacket back.
                A value of -1 means that no independent packet is present in the stream in the direction of interest. Otherwise,
                for kAudioFilePropertyPreviousIndependentPacket, mIndependentlyDecodablePacket will be less than mPacket, and
                for kAudioFilePropertyNextIndependentPacket, mIndependentlyDecodablePacket will be greater than mPacket.
@constant   kAudioFilePropertyPacketToDependencyInfo
                Pass an AudioPacketDependencyInfoTranslation with mPacket filled out and get mIsIndependentlyDecodable
                and mPrerollPacketCount back.
                A value of 0 for mIsIndependentlyDecodable indicates that the specified packet is not independently decodable.
                A value of 1 for mIsIndependentlyDecodable indicates that the specified packet is independently decodable.
                For independently decodable packets, mPrerollPacketCount indicates the count of packets that must be decoded
                after the packet with the specified number in order to refresh the decoder.
                If the value of kAudioFilePropertyRestrictsRandomAccess is 1, either kAudioFilePropertyPacketToRollDistance or
                kAudioFilePropertyPacketToDependencyInfo must be used in order to identify an appropriate random access point.

将包数转换成字节数   AudioFramePacketTranslation中mPacket做输入,mByte做输出
    @constant   kAudioFilePropertyPacketToByte
                pass an AudioBytePacketTranslation struct with mPacket filled out and get mByte back.
                mByteOffsetInPacket is ignored. If the mByte value is an estimate then 
                kBytePacketTranslationFlag_IsEstimate will be set in the mFlags field.

 将字节数转换成包数  AudioFramePacketTranslation中mByte做输入,mPacket和mByteOffsetInPacket做输出
 @constant  kAudioFilePropertyByteToPacket
                pass an AudioBytePacketTranslation struct with mByte filled out and get mPacket and
                mByteOffsetInPacket back. If the mPacket value is an estimate then 
                kBytePacketTranslationFlag_IsEstimate will be set in the mFlags field.
            
文件中的chunk编码格式   4字符编码格式数组       
@constant   kAudioFilePropertyChunkIDs 
                returns an array of OSType four char codes for each kind of chunk in the file.

字典表示的Info   CFDictionary
@constant   kAudioFilePropertyInfoDictionary 
                returns a CFDictionary filled with information about the data contained in the file. 
                See dictionary key constants already defined for info string types. 
                AudioFileComponents are free to add keys to the dictionaries that they return for this property...
                caller is responsible for releasing the CFObject

设置PacketTableInfo   PacketTableInfo
@constant   kAudioFilePropertyPacketTableInfo 
                Gets or sets an AudioFilePacketTableInfo struct for the file types that support it.
                When setting, the sum of mNumberValidFrames, mPrimingFrames and mRemainderFrames must be the same as the total
                number of frames in all packets. If not you will get a kAudio_ParamError. The best way to ensure this is to get the value of
                the property and make sure the sum of the three values you set has the same sum as the three values you got.

理论上的最大Packet大小  Uint64
@constant   kAudioFilePropertyPacketSizeUpperBound
                a UInt32 for the theoretical maximum packet size in the file (without actually scanning
                the whole file to find the largest packet, as may happen with kAudioFilePropertyMaximumPacketSize).


@constant   kAudioFilePropertyPacketRangeByteCountUpperBound
                Pass an AudioPacketRangeByteCountTranslation with mPacket and mPacketCount filled out
                and get mByteCountUpperBound back. The value of mByteCountUpperBound can be used to allocate a buffer
                for use with AudioFileReadPacketData in order to accommodate the entire packet range.
                May require scanning in order to obtain the requested information, but even if so, no scanning will occur
                beyond the last packet in the specified range.
                For file formats in which packets are directly accessible and stored both contiguously and byte-aligned,
                the returned upper bound will be equal to the total size of the packets in the range. Otherwise the
                upper bound may reflect per-packet storage overhead.

设置写保护区大小,单位为秒   Uint32
@constant   kAudioFilePropertyReserveDuration
                The value is a Float64 of the duration in seconds of data that is expected to be written.
                Setting this property before any data has been written reserves space in the file header for a packet table 
                and/or other information so that it can appear before the audio data. Otherwise the packet table may get written at the 
                end of the file, preventing the file from being streamable.

估算的音频时长 , 单位秒   Uint32
@constant   kAudioFilePropertyEstimatedDuration
                The value is a Float64 representing an estimated duration in seconds. If duration can be calculated without scanning the entire file,
                or all the audio data packets have been scanned, the value will accurately reflect the duration of the audio data. 
码率  Uint32
@constant   kAudioFilePropertyBitRate
                Returns the bit rate for the audio data as a UInt32. For some formats this will be approximate.

    位深度 Uint32
@constant   kAudioFilePropertySourceBitDepth
                For encoded data this property returns the bit depth of the source as an SInt32, if known.
                The bit depth is expressed as a negative number if the source was floating point, e.g. -32 for float, -64 for double.

     专辑名    CFDataRef
@constant   kAudioFilePropertyAlbumArtwork
                returns a CFDataRef filled with the Album Art or NULL. 
                The caller is responsible for releasing a non-NULL CFDataRef.
                In order to parse the contents of the data, CGImageSourceCreateWithData may be used.

@constant   kAudioFilePropertyAudioTrackCount
                a UInt32 that indicates the number of audio tracks contained in the file. (get property only)
@constant   kAudioFilePropertyUseAudioTrack
                a UInt32 that indicates the number of audio tracks contained in the file. (set property only)


@constant   kAudioFilePropertyID3Tag
                A void * pointing to memory set up by the caller to contain a fully formatted ID3 tag (get/set v2.2, v2.3, or v2.4, v1 get only).
                The ID3 tag is not manipulated in anyway either for read or write. 
                When setting, this property must be called before calling AudioFileWritePackets.

相关文章

网友评论

      本文标题:AudioFilePropertyID

      本文链接:https://www.haomeiwen.com/subject/revznhtx.html