diff --git a/litecam/README.md b/litecam/README.md index 751d8f5..b8fcecb 100644 --- a/litecam/README.md +++ b/litecam/README.md @@ -1,6 +1,6 @@ # LiteCam -LiteCam is a lightweight, cross-platform library for capturing RGB frames from cameras and displaying them. Designed with simplicity and ease of integration in mind, LiteCam supports Windows and Linux platforms. +LiteCam is a lightweight, cross-platform library for capturing RGB frames from cameras and displaying them. Designed with simplicity and ease of integration in mind, LiteCam supports **Windows**, **Linux** and **macOS** platforms. ## Demo Video - Linux Virtual Machine @@ -24,6 +24,7 @@ LiteCam is a lightweight, cross-platform library for capturing RGB frames from c - **Windows**: Uses Media Foundation for video capture. - **Linux**: Uses Video4Linux (V4L2) and X11 for video capture and rendering. +- **macOS**: Uses AVFoundation for video capture. ## Requirements @@ -43,7 +44,11 @@ LiteCam is a lightweight, cross-platform library for capturing RGB frames from c sudo apt update sudo apt install libx11-dev ``` - + +### macOS +- Xcode +- Development libraries for AVFoundation (included with macOS) + ## Installation 1. Clone the repository: @@ -102,15 +107,16 @@ int main() ### API Overview #### Camera - +- **`std::vector ListCaptureDevices()`**: Lists available video capture devices. - **`bool Open(int cameraIndex)`**: Opens the camera with the specified index. +- **`bool SetResolution(int width, int height)`**: Sets the resolution for the camera. +- **`std::vector ListSupportedMediaTypes()`**: Lists supported media types. - **`FrameData CaptureFrame()`**: Captures a single RGB frame. - **`void ReleaseFrame(FrameData &frame)`**: Releases the memory allocated for a frame. - **`void Release()`**: Closes the camera and releases resources. - **`void saveFrameAsJPEG(const char *filename, const unsigned char *rgbData, int width, int height)`**: Saves the frame as a JPEG image. #### CameraWindow - - **`bool Create()`**: Initializes and creates a window. - **`void Show()`**: Displays the window. - **`bool WaitKey(char key)`**: Waits for user input; returns `false` if the specified key is pressed or the window is closed. diff --git a/litecam/dist/include/CameraPreview.h b/litecam/dist/include/CameraPreview.h index fc5021a..81842be 100644 --- a/litecam/dist/include/CameraPreview.h +++ b/litecam/dist/include/CameraPreview.h @@ -9,8 +9,8 @@ #elif __linux__ #include #include -#elif __APPLE__ -#include +// #elif __APPLE__ +// #include #endif // Export macro for shared library @@ -66,6 +66,7 @@ class CAMERA_API CameraWindow #elif __APPLE__ // Add macOS-specific members (e.g., NSWindow or CGContext) void *nsWindow; // Use proper macOS data structures here + void *contentView; #endif }; diff --git a/litecam/dist/lib/mac/liblitecam.dylib b/litecam/dist/lib/mac/liblitecam.dylib new file mode 100755 index 0000000..8460489 Binary files /dev/null and b/litecam/dist/lib/mac/liblitecam.dylib differ