1 /* 2 * Copyright (c) 2021 Rockchip Corporation 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 * 16 */ 17 #ifndef _CIF_SCALE_STREAM_H_ 18 #define _CIF_SCALE_STREAM_H_ 19 #include <map> 20 #include <v4l2_device.h> 21 #include "poll_thread.h" 22 #include "xcam_mutex.h" 23 #include "Stream.h" 24 #include "smart_buffer_priv.h" 25 using namespace XCam; 26 27 namespace RkCam { 28 29 class CifSclStream 30 { 31 public: 32 explicit CifSclStream(); 33 virtual ~CifSclStream(); 34 XCamReturn start(); 35 XCamReturn stop (); 36 void set_working_mode(int mode); 37 XCamReturn set_format(const struct v4l2_subdev_format& sns_sd_fmt, uint32_t sns_v4l_pix_fmt, int bpp); 38 XCamReturn set_format(const struct v4l2_subdev_selection& sns_sd_sel, uint32_t sns_v4l_pix_fmt, int bpp); 39 XCamReturn prepare(); 40 XCamReturn restart(const rk_sensor_full_info_t *s_info, int ratio, PollCallback *callback, int mode); 41 XCamReturn init(const rk_sensor_full_info_t *s_info, PollCallback *callback); 42 XCamReturn set_ratio_fmt(int ratio); 43 virtual bool setPollCallback (PollCallback *callback); 44 void set_bpp(int bpp); 45 bool getIsActive(); 46 protected: 47 XCAM_DEAD_COPY (CifSclStream); 48 private: 49 SmartPtr<V4l2Device> _dev[3]; 50 SmartPtr<RKStream> _stream[3]; 51 int _working_mode; 52 int _bpp; 53 int index; 54 uint32_t _width; 55 uint32_t _height; 56 uint32_t _sns_v4l_pix_fmt; 57 int _ratio; 58 bool _first_start; 59 bool _active{false}; 60 bool _init{false}; 61 }; 62 63 } 64 #endif