Package com.orbbec.obsensor

## Class Pipeline

- java.lang.Object
- - com.orbbec.obsensor.LobClass
  - - com.orbbec.obsensor.Pipeline

All Implemented Interfaces:
  `java.lang.AutoCloseable`

    public class Pipeline
    extends LobClass

pipeline: used to control data, it conflicts with the start method of the Sensor class, and the start method cannot be used to start the data stream at the same time. Additional operations can be extended, such as setting high-level interfaces such as data frame synchronization

### Field Summary

### Fields inherited from class com.orbbec.obsensor.LobClass

`handle, owner`

### Constructor Summary

Constructors
`Pipeline​(Device device)` Use the specified device to create a Pipeline.
`Pipeline​(java.lang.String playbackFile)` Use the playback file to create a pipeline object

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`void` `close()` pipeline resource release
`void` `disableFrameSync()` disable frame sync
`void` `enableFrameSync()` Enable frame sync
`CameraParam` `getCameraParam()` Get the camera parameters after D2C.
`CameraParam` `getCameraParamWithProfile​(int colorWidth, int colorHeight, int depthWidth, int depthHeight)` Get camera parameters by entering color and depth resolution If D2C is enabled, it will return the camera parameters after D2C, if not, it will return to the default parameters
`Config` `getConfig()` Get the current pipeline configuration, which is configured by the start method
`StreamProfileList` `getD2CDepthProfileList​(StreamProfile colorProfile, AlignMode mode)` Returns a list of D2C-enabled depth sensor resolutions corresponding to the input color sensor resolution
`OBRect` `getD2CRangeValidArea​(int minimumDistance, int maximumDistance)` Get valid area between minimum distance and maximum distance after D2C
`OBRect` `getD2CValidArea​(int distance)` Deprecated.
`Playback` `getPlayback()` Get playback object from pipeline
`StreamProfileList` `getStreamProfileList​(SensorType sensorType)` Get the dataflow configuration supported by the specified sensor type
`void` `start​(Config config)` Open the data stream of the specified configuration.
`void` `start​(Config config, FrameSetCallback callback)` Open the data stream of the specified configuration, and set the callback of the data frame set.
`void` `startRecord​(java.lang.String filePath)` Start recording
`void` `stop()` stop data stream
`void` `stopRecord()` stop recording
`void` `switchConfig​(Config config)` Dynamically switch the corresponding config configuration
`FrameSet` `waitForFrameSet​(long timeoutMilliseconds)` Query method to obtain data frame set Important: frameset must be called after the data frame is used, Close() and frame Close() releases resources

### Methods inherited from class com.orbbec.obsensor.LobClass

`getHandle, throwInitializeException`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### Pipeline

    public Pipeline​(Device device)

Use the specified device to create a Pipeline. To create a Pipeline through this interface, you need to create the corresponding device first.

Parameters:
  `device` - device.

#### Pipeline

    public Pipeline​(java.lang.String playbackFile)

Use the playback file to create a pipeline object

Parameters:
  `playbackFile` - The playback file path used to create the pipeline

### Method Detail

#### start

    public void start​(Config config)

Open the data stream of the specified configuration. If you need to use the configuration in the configuration file to open the stream, pass null to config (if there is no configuration file in the case of config passing null, the first one in the open flow configuration list is used by default to open the stream. )

Note: If the pipeline is created by playback file, it means start playback, at this time, config can pass null

Parameters:
  `config` - pipeline configuration

#### start

    public void start​(Config config,
                      FrameSetCallback callback)

Open the data stream of the specified configuration, and set the callback of the data frame set. If you need to use the configuration in the configuration file to open the stream, pass null to config (if there is no configuration file in the case of config passing null, the open stream configuration list is used by default. the first to open flow)

Note: If the pipeline is created by the playback file, it means that the playback starts in the callback mode. At this time, config can pass null.

Important: After the callback data frame is used up, FrameSet#close() and Frame#close() must be called to release resources.

Parameters:
  `config` - pipeline configuration
  `callback` - Data frame set callback

#### stop

    public void stop()

stop data stream

#### waitForFrameSet

    public FrameSet waitForFrameSet​(long timeoutMilliseconds)

Query method to obtain data frame set Important: frameset must be called after the data frame is used, Close() and frame Close() releases resources

Parameters:
  `timeoutMilliseconds` - wait timeout
Returns:
  Data frameset

#### getConfig

    public Config getConfig()

Get the current pipeline configuration, which is configured by the start method

Returns:
  pipeline configuration

#### enableFrameSync

    public void enableFrameSync()

Enable frame sync

#### disableFrameSync

    public void disableFrameSync()

disable frame sync

#### getStreamProfileList

    public StreamProfileList getStreamProfileList​(SensorType sensorType)

Get the dataflow configuration supported by the specified sensor type

Parameters:
  `sensorType` - Sensor Type
Returns:
  stream profile list

#### switchConfig

    public void switchConfig​(Config config)

Dynamically switch the corresponding config configuration

Parameters:
  `config` - pipeline configuration

#### getD2CDepthProfileList

    public StreamProfileList getD2CDepthProfileList​(StreamProfile colorProfile,
                                                    AlignMode mode)

Returns a list of D2C-enabled depth sensor resolutions corresponding to the input color sensor resolution

Parameters:
  `colorProfile` - Input color sensor resolution
  `mode` - The align mode of D2C
Returns:
  a configuration list of matching depths

#### getD2CValidArea

    @Deprecated
    public OBRect getD2CValidArea​(int distance)

Deprecated.
Valid area after getting D2C

Parameters:
  `distance` - Working distance(mm)
Returns:
  Returns the area information valid after D2c at the working distance

#### getD2CRangeValidArea

    public OBRect getD2CRangeValidArea​(int minimumDistance,
                                       int maximumDistance)

Get valid area between minimum distance and maximum distance after D2C

Parameters:
  `minimumDistance` - minimum working distance(mm)
  `maximumDistance` - maximum working distance(mm)
Returns:
  returns the area information valid after D2C at working distance

#### getCameraParam

    public CameraParam getCameraParam()

Get the camera parameters after D2C. When the pipeline is created by the playback file, the camera internal parameters of the playback device are obtained

Returns:
  Returns the aligned camera internal parameter

#### getCameraParamWithProfile

    public CameraParam getCameraParamWithProfile​(int colorWidth,
                                                 int colorHeight,
                                                 int depthWidth,
                                                 int depthHeight)

Get camera parameters by entering color and depth resolution If D2C is enabled, it will return the camera parameters after D2C, if not, it will return to the default parameters

Parameters:
  `colorWidth` - Width of color resolution
  `colorHeight` - High of color resolution
  `depthWidth` - Width of depth resolution
  `depthHeight` - High of depth resolution
Returns:
  OBCameraParam returns camera parameters

#### startRecord

    public void startRecord​(java.lang.String filePath)

Start recording

Parameters:
  `filePath` - Recorded file path

#### stopRecord

    public void stopRecord()

stop recording

#### getPlayback

    public Playback getPlayback()

Get playback object from pipeline

Returns:
  Returns the playback object

#### close

    public void close()

pipeline resource release