Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

Swift - Core Foudation

nakajijapan
December 17, 2014

Swift - Core Foudation

#potatotips12

nakajijapan

December 17, 2014
Tweet

More Decks by nakajijapan

Other Decks in Technology

Transcript

  1. /*! @typedef CMSampleBufferRef @abstract A reference to a CMSampleBuffer, a

    CF object containing zero or more compressed (or uncompressed) samples of a particular media type (audio, video, muxed, etc). */ typedef struct opaqueCMSampleBuffer *CMSampleBufferRef; $.4BNQMF#V⒎FSI /*! @typedef CMSampleBufferRef @abstract A reference to a CMSampleBuffer, a CF object containing zero or more compressed (or uncompressed) samples of a particular media type (audio, video, muxed, etc). */ typealias CMSampleBufferRef = CMSampleBuffer
  2. /*! @typedef CMSampleBufferRef @abstract A reference to a CMSampleBuffer, a

    CF object containing zero or more compressed (or uncompressed) samples of a particular media type (audio, video, muxed, etc). */ typedef struct opaqueCMSampleBuffer *CMSampleBufferRef; $.4BNQMF#V⒎FSI /*! @typedef CMSampleBufferRef @abstract A reference to a CMSampleBuffer, a CF object containing zero or more compressed (or uncompressed) samples of a particular media type (audio, video, muxed, etc). */ typealias CMSampleBufferRef = CMSampleBuffer
  3. /*! @typedef CMSampleBufferRef @abstract A reference to a CMSampleBuffer, a

    CF object containing zero or more compressed (or uncompressed) samples of a particular media type (audio, video, muxed, etc). */ typedef struct opaqueCMSampleBuffer *CMSampleBufferRef; $.4BNQMF#V⒎FSI /*! @typedef CMSampleBufferRef @abstract A reference to a CMSampleBuffer, a CF object containing zero or more compressed (or uncompressed) samples of a particular media type (audio, video, muxed, etc). */ typealias CMSampleBufferRef = CMSampleBuffer PQBRVF$.4BNQMF#VGGFS ͕ͳ͍͡Όͳ͍͔
  4. /*! @typedef CMSampleBufferRef @abstract A reference to a CMSampleBuffer, a

    CF object containing zero or more compressed (or uncompressed) samples of a particular media type (audio, video, muxed, etc). */ typedef struct opaqueCMSampleBuffer *CMSampleBufferRef; $.4BNQMF#V⒎FSI /*! @typedef CMSampleBufferRef @abstract A reference to a CMSampleBuffer, a CF object containing zero or more compressed (or uncompressed) samples of a particular media type (audio, video, muxed, etc). */ typealias CMSampleBufferRef = CMSampleBuffer PQBRVF$.4BNQMF#VGGFS ͕ͳ͍͡Όͳ͍͔ ͦΕ͕0QBRVF5ZQF
  5. ؔ਺Λ௨ͯ͠ߦ͏ $.4BNQMF#V⒎FS$SFBUF $.4BNQMF#V⒎FS$SFBUF$PQZ  $.4BNQMF#V⒎FS$SFBUF$PQZ8JUI/FX5JNJOH $.4BNQMF#V⒎FS$SFBUF'PS*NBHF#V⒎FS  $.4BNQMF#V⒎FS%BUB*T3FBEZ $.4BNQMF#V⒎FS(FU"VEJP#V⒎FS-JTU8JUI3FUBJOFE#MPDL#V⒎FS 

    $.4BNQMF#V⒎FS(FU"VEJP4USFBN1BDLFU%FTDSJQUJPOT  $.4BNQMF#V⒎FS(FU"VEJP4USFBN1BDLFU%FTDSJQUJPOT1US $.4BNQMF#V⒎FS(FU%BUB#V⒎FS  $.4BNQMF#V⒎FS(FU%FDPEF5JNF4UBNQ $.4BNQMF#V⒎FS(FU%VSBUJPO  $.4BNQMF#V⒎FS(FU'PSNBU%FTDSJQUJPO $.4BNQMF#V⒎FS(FU*NBHF#V⒎FS  $.4BNQMF#V⒎FS(FU/VN4BNQMFT $.4BNQMF#V⒎FS(FU0VUQVU%FDPEF5JNF4UBNQ  $.4BNQMF#V⒎FS(FU0VUQVU%VSBUJPO $.4BNQMF#V⒎FS(FU0VUQVU1SFTFOUBUJPO5JNF4UBNQ  $.4BNQMF#V⒎FS(FU0VUQVU4BNQMF5JNJOH*OGP"SSBZ  $.4BNQMF#V⒎FS(FU1SFTFOUBUJPO5JNF4UBNQ $.4BNQMF#V⒎FS(FU4BNQMF"UUBDINFOUT"SSBZ  $.4BNQMF#V⒎FS(FU4BNQMF4J[F $.4BNQMF#V⒎FS(FU4BNQMF4J[F"SSBZ  $.4BNQMF#V⒎FS(FU4BNQMF5JNJOH*OGP $.4BNQMF#V⒎FS(FU4BNQMF5JNJOH*OGP"SSBZ  $.4BNQMF#V⒎FS(FU5PUBM4BNQMF4J[F $.4BNQMF#V⒎FS(FU5ZQF*% $.4BNQMF#V⒎FS*OWBMJEBUF  $.4BNQMF#V⒎FS*T7BMJE $.4BNQMF#V⒎FS.BLF%BUB3FBEZ $.4BNQMF#V⒎FS4FU%BUB#V⒎FS  $.4BNQMF#V⒎FS4FU%BUB#V⒎FS'SPN"VEJP#V⒎FS-JTU $.4BNQMF#V⒎FS4FU%BUB3FBEZ  $.4BNQMF#V⒎FS4FU*OWBMJEBUF$BMMCBDL $.4BNQMF#V⒎FS4FU0VUQVU1SFTFOUBUJPO5JNF4UBNQ  $.4BNQMF#V⒎FS5SBDL%BUB3FBEJOFTT 
  6. /*! @typedef CMSampleBufferRef @abstract A reference to a CMSampleBuffer, a

    CF object containing zero or more compressed (or uncompressed) samples of a particular media type (audio, video, muxed, etc). */ typedef struct opaqueCMSampleBuffer *CMSampleBufferRef; $.4BNQMF#V⒎FSI /*! @typedef CMSampleBufferRef @abstract A reference to a CMSampleBuffer, a CF object containing zero or more compressed (or uncompressed) samples of a particular media type (audio, video, muxed, etc). */ typealias CMSampleBufferRef = CMSampleBuffer
  7. $.4BNQMF#VGGFS $7*NBHF#V⒎FS3FGJNBHF#V⒎FS $.4BNQMF#V⒎FS(FU*NBHF#V⒎FS TBNQMF#V⒎FS  var anUnmanaged : Unmanaged<CVImageBuffer> =

    CMSampleBufferGetImageBuffer(sampleBuffer) var returnValue = anUnmanaged.takeUnretainedValue() var anOpaque = anUnmanaged.toOpaque() var pixelBuffer:CVPixelBuffer = Unmanaged<CVPixelBuffer>.fromOpaque(anOpaque).takeUnretainedValue()
  8. $.4BNQMF#VGGFS $7*NBHF#V⒎FS3FGJNBHF#V⒎FS $.4BNQMF#V⒎FS(FU*NBHF#V⒎FS TBNQMF#V⒎FS  var anUnmanaged : Unmanaged<CVImageBuffer> =

    CMSampleBufferGetImageBuffer(sampleBuffer) var returnValue = anUnmanaged.takeUnretainedValue() var anOpaque = anUnmanaged.toOpaque() var pixelBuffer:CVPixelBuffer = CMSampleBufferGetImageBuffer(sampleBuffer)
  9. /// Get the value of this unmanaged reference as a

    managed /// reference and consume an unbalanced retain of it. /// /// This is useful when a function returns an unmanaged reference /// and you know that you're responsible for releasing the result. func takeRetainedValue() -> T 4XJGU6ONBOFHFE /// Get the value of this unmanaged reference as a managed /// reference without consuming an unbalanced retain of it. /// /// This is useful when a function returns an unmanaged reference /// and you know that you're not responsible for releasing the result. func takeUnretainedValue() -> T