Contents

init(display:outputWidth:outputHeight:pixelFormat:properties:handler:)

Creates a new display stream to be used with a CFRunloop.

Declaration

init?(display: CGDirectDisplayID, outputWidth: Int, outputHeight: Int, pixelFormat: Int32, properties: CFDictionary?, handler: CGDisplayStreamFrameAvailableHandler?)

Parameters

  • display:

    The identifier of the display to be streamed.

  • outputWidth:

    The width of the output frames in pixels. The width must not be zero.

  • outputHeight:

    The height of the output frames in pixels. The height must not be zero.

  • pixelFormat:

    The desired Core Media pixel format of the output frame data. The value must be one of the following:

    • 'BGRA': Packed Little Endian ARGB8888

    • 'l10r': Packed Little Endian ARGB2101010

    • '420v': 2-plane “video” range YCbCr 4:2:0

    • '420f': 2-plane “full” range YCbCr 4:2:0

  • properties:

    A dictionary of optional properties for the display stream. See Display Stream Optional Property Keys for the possible keys and values that can be provided in the options dictionary.

  • handler:

    A block to be called when new frames are ready.

Return Value

A new CGDisplayStream object.

Discussion

Before the stream can be started, it must be added to a run loop. Use the runLoopSource function to get an event source to add to the run loop.

See Also

Functions