123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372 |
-
- using OpenCVForUnity.CoreModule;
- using OpenCVForUnity.UtilsModule;
- using System;
- using System.Collections.Generic;
- using System.Runtime.InteropServices;
- namespace OpenCVForUnity.VideoioModule {
- // C++: class VideoWriter
- //javadoc: VideoWriter
- public class VideoWriter : DisposableOpenCVObject {
- protected override void Dispose(bool disposing) {
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- try {
- if (disposing) {
- }
- if (IsEnabledDispose) {
- if (nativeObj != IntPtr.Zero)
- videoio_VideoWriter_delete(nativeObj);
- nativeObj = IntPtr.Zero;
- }
- } finally {
- base.Dispose(disposing);
- }
- #else
- return;
- #endif
- }
- protected internal VideoWriter(IntPtr addr) : base(addr) { }
- public IntPtr getNativeObjAddr() { return nativeObj; }
- // internal usage only
- public static VideoWriter __fromPtr__(IntPtr addr) { return new VideoWriter(addr); }
- //
- // C++: cv::VideoWriter::VideoWriter(String filename, int apiPreference, int fourcc, double fps, Size frameSize, bool isColor = true)
- //
- //javadoc: VideoWriter::VideoWriter(filename, apiPreference, fourcc, fps, frameSize, isColor)
- public VideoWriter(string filename, int apiPreference, int fourcc, double fps, Size frameSize, bool isColor) {
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- nativeObj = videoio_VideoWriter_VideoWriter_10(filename, apiPreference, fourcc, fps, frameSize.width, frameSize.height, isColor);
- return;
- #else
- return;
- #endif
- }
- //javadoc: VideoWriter::VideoWriter(filename, apiPreference, fourcc, fps, frameSize)
- public VideoWriter(string filename, int apiPreference, int fourcc, double fps, Size frameSize) {
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- nativeObj = videoio_VideoWriter_VideoWriter_11(filename, apiPreference, fourcc, fps, frameSize.width, frameSize.height);
- return;
- #else
- return;
- #endif
- }
- //
- // C++: cv::VideoWriter::VideoWriter(String filename, int fourcc, double fps, Size frameSize, bool isColor = true)
- //
- //javadoc: VideoWriter::VideoWriter(filename, fourcc, fps, frameSize, isColor)
- public VideoWriter(string filename, int fourcc, double fps, Size frameSize, bool isColor) {
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- nativeObj = videoio_VideoWriter_VideoWriter_12(filename, fourcc, fps, frameSize.width, frameSize.height, isColor);
- return;
- #else
- return;
- #endif
- }
- //javadoc: VideoWriter::VideoWriter(filename, fourcc, fps, frameSize)
- public VideoWriter(string filename, int fourcc, double fps, Size frameSize) {
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- nativeObj = videoio_VideoWriter_VideoWriter_13(filename, fourcc, fps, frameSize.width, frameSize.height);
- return;
- #else
- return;
- #endif
- }
- //
- // C++: cv::VideoWriter::VideoWriter()
- //
- //javadoc: VideoWriter::VideoWriter()
- public VideoWriter() {
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- nativeObj = videoio_VideoWriter_VideoWriter_14();
- return;
- #else
- return;
- #endif
- }
- //
- // C++: String cv::VideoWriter::getBackendName()
- //
- //javadoc: VideoWriter::getBackendName()
- public string getBackendName() {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- string retVal = Marshal.PtrToStringAnsi(videoio_VideoWriter_getBackendName_10(nativeObj));
- return retVal;
- #else
- return null;
- #endif
- }
- //
- // C++: bool cv::VideoWriter::isOpened()
- //
- //javadoc: VideoWriter::isOpened()
- public bool isOpened() {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- bool retVal = videoio_VideoWriter_isOpened_10(nativeObj);
- return retVal;
- #else
- return false;
- #endif
- }
- //
- // C++: bool cv::VideoWriter::open(String filename, int apiPreference, int fourcc, double fps, Size frameSize, bool isColor = true)
- //
- //javadoc: VideoWriter::open(filename, apiPreference, fourcc, fps, frameSize, isColor)
- public bool open(string filename, int apiPreference, int fourcc, double fps, Size frameSize, bool isColor) {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- bool retVal = videoio_VideoWriter_open_10(nativeObj, filename, apiPreference, fourcc, fps, frameSize.width, frameSize.height, isColor);
- return retVal;
- #else
- return false;
- #endif
- }
- //javadoc: VideoWriter::open(filename, apiPreference, fourcc, fps, frameSize)
- public bool open(string filename, int apiPreference, int fourcc, double fps, Size frameSize) {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- bool retVal = videoio_VideoWriter_open_11(nativeObj, filename, apiPreference, fourcc, fps, frameSize.width, frameSize.height);
- return retVal;
- #else
- return false;
- #endif
- }
- //
- // C++: bool cv::VideoWriter::open(String filename, int fourcc, double fps, Size frameSize, bool isColor = true)
- //
- //javadoc: VideoWriter::open(filename, fourcc, fps, frameSize, isColor)
- public bool open(string filename, int fourcc, double fps, Size frameSize, bool isColor) {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- bool retVal = videoio_VideoWriter_open_12(nativeObj, filename, fourcc, fps, frameSize.width, frameSize.height, isColor);
- return retVal;
- #else
- return false;
- #endif
- }
- //javadoc: VideoWriter::open(filename, fourcc, fps, frameSize)
- public bool open(string filename, int fourcc, double fps, Size frameSize) {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- bool retVal = videoio_VideoWriter_open_13(nativeObj, filename, fourcc, fps, frameSize.width, frameSize.height);
- return retVal;
- #else
- return false;
- #endif
- }
- //
- // C++: bool cv::VideoWriter::set(int propId, double value)
- //
- //javadoc: VideoWriter::set(propId, value)
- public bool set(int propId, double value) {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- bool retVal = videoio_VideoWriter_set_10(nativeObj, propId, value);
- return retVal;
- #else
- return false;
- #endif
- }
- //
- // C++: double cv::VideoWriter::get(int propId)
- //
- //javadoc: VideoWriter::get(propId)
- public double get(int propId) {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- double retVal = videoio_VideoWriter_get_10(nativeObj, propId);
- return retVal;
- #else
- return -1;
- #endif
- }
- //
- // C++: static int cv::VideoWriter::fourcc(char c1, char c2, char c3, char c4)
- //
- //javadoc: VideoWriter::fourcc(c1, c2, c3, c4)
- public static int fourcc(char c1, char c2, char c3, char c4) {
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- int retVal = videoio_VideoWriter_fourcc_10(c1, c2, c3, c4);
- return retVal;
- #else
- return -1;
- #endif
- }
- //
- // C++: void cv::VideoWriter::release()
- //
- //javadoc: VideoWriter::release()
- public void release() {
- ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- videoio_VideoWriter_release_10(nativeObj);
- return;
- #else
- return;
- #endif
- }
- //
- // C++: void cv::VideoWriter::write(Mat image)
- //
- //javadoc: VideoWriter::write(image)
- public void write(Mat image) {
- ThrowIfDisposed();
- if (image != null) image.ThrowIfDisposed();
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- videoio_VideoWriter_write_10(nativeObj, image.nativeObj);
- return;
- #else
- return;
- #endif
- }
- #if (UNITY_ANDROID && !UNITY_EDITOR)
- const string LIBNAME = "opencvforunity";
- // C++: cv::VideoWriter::VideoWriter(String filename, int apiPreference, int fourcc, double fps, Size frameSize, bool isColor = true)
- [DllImport(LIBNAME)]
- private static extern IntPtr videoio_VideoWriter_VideoWriter_10(string filename, int apiPreference, int fourcc, double fps, double frameSize_width, double frameSize_height, bool isColor);
- [DllImport(LIBNAME)]
- private static extern IntPtr videoio_VideoWriter_VideoWriter_11(string filename, int apiPreference, int fourcc, double fps, double frameSize_width, double frameSize_height);
- // C++: cv::VideoWriter::VideoWriter(String filename, int fourcc, double fps, Size frameSize, bool isColor = true)
- [DllImport(LIBNAME)]
- private static extern IntPtr videoio_VideoWriter_VideoWriter_12(string filename, int fourcc, double fps, double frameSize_width, double frameSize_height, bool isColor);
- [DllImport(LIBNAME)]
- private static extern IntPtr videoio_VideoWriter_VideoWriter_13(string filename, int fourcc, double fps, double frameSize_width, double frameSize_height);
- // C++: cv::VideoWriter::VideoWriter()
- [DllImport(LIBNAME)]
- private static extern IntPtr videoio_VideoWriter_VideoWriter_14();
- // C++: String cv::VideoWriter::getBackendName()
- [DllImport(LIBNAME)]
- private static extern IntPtr videoio_VideoWriter_getBackendName_10(IntPtr nativeObj);
- // C++: bool cv::VideoWriter::isOpened()
- [DllImport(LIBNAME)]
- private static extern bool videoio_VideoWriter_isOpened_10(IntPtr nativeObj);
- // C++: bool cv::VideoWriter::open(String filename, int apiPreference, int fourcc, double fps, Size frameSize, bool isColor = true)
- [DllImport(LIBNAME)]
- private static extern bool videoio_VideoWriter_open_10(IntPtr nativeObj, string filename, int apiPreference, int fourcc, double fps, double frameSize_width, double frameSize_height, bool isColor);
- [DllImport(LIBNAME)]
- private static extern bool videoio_VideoWriter_open_11(IntPtr nativeObj, string filename, int apiPreference, int fourcc, double fps, double frameSize_width, double frameSize_height);
- // C++: bool cv::VideoWriter::open(String filename, int fourcc, double fps, Size frameSize, bool isColor = true)
- [DllImport(LIBNAME)]
- private static extern bool videoio_VideoWriter_open_12(IntPtr nativeObj, string filename, int fourcc, double fps, double frameSize_width, double frameSize_height, bool isColor);
- [DllImport(LIBNAME)]
- private static extern bool videoio_VideoWriter_open_13(IntPtr nativeObj, string filename, int fourcc, double fps, double frameSize_width, double frameSize_height);
- // C++: bool cv::VideoWriter::set(int propId, double value)
- [DllImport(LIBNAME)]
- private static extern bool videoio_VideoWriter_set_10(IntPtr nativeObj, int propId, double value);
- // C++: double cv::VideoWriter::get(int propId)
- [DllImport(LIBNAME)]
- private static extern double videoio_VideoWriter_get_10(IntPtr nativeObj, int propId);
- // C++: static int cv::VideoWriter::fourcc(char c1, char c2, char c3, char c4)
- [DllImport(LIBNAME)]
- private static extern int videoio_VideoWriter_fourcc_10(char c1, char c2, char c3, char c4);
- // C++: void cv::VideoWriter::release()
- [DllImport(LIBNAME)]
- private static extern void videoio_VideoWriter_release_10(IntPtr nativeObj);
- // C++: void cv::VideoWriter::write(Mat image)
- [DllImport(LIBNAME)]
- private static extern void videoio_VideoWriter_write_10(IntPtr nativeObj, IntPtr image_nativeObj);
- // native support for java finalize()
- [DllImport(LIBNAME)]
- private static extern void videoio_VideoWriter_delete(IntPtr nativeObj);
- #endif
- }
- }
|