반응형
Notice
Recent Posts
Recent Comments
Link
250x250
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- l4t
- gstsample
- RDEPENDS
- 봉화 숲속캠핑장
- libargus api
- meta-tegra
- boot process
- mkfs.ext4
- bash
- yocto
- libargus
- /dev/kmsg
- vpiimage
- vpi
- bitbake
- server error
- 오블완
- udpsink
- ssd 포맷
- orin nx
- linux
- LAYERS
- lineedit
- gcc7
- Jetson
- nvidia
- 티스토리챌린지
- nvarguscamerasrc
- camera
- cpu frequency
Archives
- Today
- Total
DREAMER
[camera] libargus api 본문
728x90
반응형
camera subsystem의 Low-level에 접근할 수 있다.
Objects와 Interfaces로 구성되며, Objects는 메소드를 갖지 않는다. 모든 메소드는 Interfaces에서 제공한다.
모든 Objects는 InterfaceProviders이다.
Objects는 두가지 타입 중 하나이다.
- Destructable: client에 의해 생성되고, 소유되며, 파괴된다.
- Non-Destructable: 다른 libargus objects의 children이며, parent object에 의해 소유되고, 파괴된다.
Interfaces는 Pure Virtual 클래스이며, 접두사 'I'로 시작한다.
InterfaceProvider(Object)로부터 런타임시에 획득된다.
InterfaceProvider class
- libargus Interface를 제공하는 클래스의 기본 Interface
class InterfaceProvider : NonCopyable
{
public:
/**
* 'interfaceId'로 지정된 인터페이스를 가져온다.
* 요청된 인터페이스의 인스턴스를 반환하거나, NULL을 반환한다.
*/
virtual Interface* getInterface(const InterfaceID& interfaceId) = 0;
protected:
~InterfaceProvider() {}
};
IRequest Interface
- Request 설정에 대한 core Interface
DEFINE_UUID(InterfaceID, IID_REQUEST, eb9b3750,fc8d,455f,8e0f,91,b3,3b,d9,4e,c5);
class IRequest : public Interface
{
public:
static const InterfaceID& id() { return IID_REQUEST; }
// 해당 output stream을 활성화 한다.
// 이 request로 생성된 captures는 해당 stream으로 output을 생성한다.
virtual Status enableOutputStream(OutputStream* stream) = 0;
virtual Status disableOutputStream(OutputStream* stream) = 0;
...
};
// Exaple Usage:
// Request object로부터 IRequest interface를 가져온다.
IRequest* iRequest = static_cast<IRequest*>(request->getInterface(IID_REQUEST));
// IRequest interface를 사용하여 메소드를 호출한다.
iRequest->enableOutputStream(stream);
Destructable Objects
- Destructable Objects는 반드시 명시적으로 파괴되어야 한다.
class Destructable {
public:
virtual void destroy() = 0;
};
// Example Usage
// Request Object는 Destructable하다.
class Request : public InterfaceProvider, public Destructable
{
public:
virtual Interface* getInterface (const InterfaceID& interfaceId) = 0;
virtual void destroy() = 0;
};
Template Utilities
- interface_cast<typename Interface T>(InterfaceProvider* obj)
- InterfaceProvider를 C++ casting semantics로 wrap한다.
- NULL InterfaceProvider로 안전하게 호출한다.
- UniqueObj<typename Destructable T>
- Destructable Objects에 사용되는 Movable 스마트 포인터이다.
- destruction동안 wrapped object의 destroy() 메소드를 호출한다.
// Before
{
Request* request = iCaptureSession->createRequest();
if (!request)
goto cleanup;
IRequest* iRequest = static_cast<IRequest*>(request->getInterface(IID_REQUEST));
if (!iRequest)
goto cleanup;
if (!iRequest->enableOutputStream(stream))
goto cleanup;
iCaptureSession->capture(request);
cleanup:
if (request)
request->destroy();
}
// After
{
UniqueObj<Request> request(iCaptureSession->createRequest());
IRequest* iRequest = interface_cast<IRequest>(request);
if (!iRequest)
RETURN_ERROR(“Failed to create Request”);
if (!iRequest->enableOutputStream(stream))
RETURN_ERROR(“Failed to enable stream”);
iCaptureSession->capture(request.get());
}
728x90
반응형
'프로그래밍 > NVIDIA' 카테고리의 다른 글
[JPEG] encodeFromFd, NvBuffer Sharing (0) | 2023.10.26 |
---|---|
[Memory] pitch linear memory, block linear memory (0) | 2023.10.19 |
[Libargus Camera API] 설치 (0) | 2023.06.29 |
[Camera] Camera Software Architecture (0) | 2023.06.22 |
[cpu freq] cpu frequency 출력 (0) | 2023.06.19 |
Comments