blob: 2b36674087948a0acbe8f420cdc4975ac109a5bd [file] [log] [blame]
Lucas A. M. Magalhãesadc589d2019-01-21 20:05:01 -05001/* SPDX-License-Identifier: GPL-2.0+ */
2/*
3 * vimc-streamer.h Virtual Media Controller Driver
4 *
5 * Copyright (C) 2018 Lucas A. M. Magalhães <lucmaga@gmail.com>
6 *
7 */
8
9#ifndef _VIMC_STREAMER_H_
10#define _VIMC_STREAMER_H_
11
12#include <media/media-device.h>
13
14#include "vimc-common.h"
15
16#define VIMC_STREAMER_PIPELINE_MAX_SIZE 16
17
Helen Fornazier43e3b722019-03-06 17:42:42 -050018/**
19 * struct vimc_stream - struct that represents a stream in the pipeline
20 *
21 * @pipe: the media pipeline object associated with this stream
22 * @ved_pipeline: array containing all the entities participating in the
23 * stream. The order is from a video device (usually a capture device) where
24 * stream_on was called, to the entity generating the first base image to be
25 * processed in the pipeline.
26 * @pipe_size: size of @ved_pipeline
27 * @kthread: thread that generates the frames of the stream.
Helen Fornazierb6c61a62019-03-13 14:29:37 -040028 * @producer_pixfmt: the pixel format requested from the pipeline. This must
29 * be set just before calling vimc_streamer_s_stream(ent, 1). This value is
30 * propagated up to the source of the base image (usually a sensor node) and
31 * can be modified by entities during s_stream callback to request a different
32 * format from rest of the pipeline.
Helen Fornazier43e3b722019-03-06 17:42:42 -050033 *
34 * When the user call stream_on in a video device, struct vimc_stream is
35 * used to keep track of all entities and subdevices that generates and
36 * process frames for the stream.
37 */
Lucas A. M. Magalhãesadc589d2019-01-21 20:05:01 -050038struct vimc_stream {
39 struct media_pipeline pipe;
40 struct vimc_ent_device *ved_pipeline[VIMC_STREAMER_PIPELINE_MAX_SIZE];
41 unsigned int pipe_size;
Lucas A. M. Magalhãesadc589d2019-01-21 20:05:01 -050042 struct task_struct *kthread;
Helen Fornazierb6c61a62019-03-13 14:29:37 -040043 u32 producer_pixfmt;
Lucas A. M. Magalhãesadc589d2019-01-21 20:05:01 -050044};
45
46/**
47 * vimc_streamer_s_streamer - start/stop the stream
48 *
49 * @stream: the pointer to the stream to start or stop
50 * @ved: The last entity of the streamer pipeline
51 * @enable: any non-zero number start the stream, zero stop
52 *
53 */
54int vimc_streamer_s_stream(struct vimc_stream *stream,
55 struct vimc_ent_device *ved,
56 int enable);
57
58#endif //_VIMC_STREAMER_H_