OpenShot Library | libopenshot 0.2.7
DecklinkWriter.h
Go to the documentation of this file.
1/**
2 * @file
3 * @brief Header file for DecklinkWriter class
4 * @author Jonathan Thomas <jonathan@openshot.org>
5 *
6 * @ref License
7 */
8
9/* LICENSE
10 *
11 * Copyright (c) 2008-2019 OpenShot Studios, LLC
12 * <http://www.openshotstudios.com/>. This file is part of
13 * OpenShot Library (libopenshot), an open-source project dedicated to
14 * delivering high quality video editing and animation solutions to the
15 * world. For more information visit <http://www.openshot.org/>.
16 *
17 * OpenShot Library (libopenshot) is free software: you can redistribute it
18 * and/or modify it under the terms of the GNU Lesser General Public License
19 * as published by the Free Software Foundation, either version 3 of the
20 * License, or (at your option) any later version.
21 *
22 * OpenShot Library (libopenshot) is distributed in the hope that it will be
23 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU Lesser General Public License for more details.
26 *
27 * You should have received a copy of the GNU Lesser General Public License
28 * along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
29 */
30
31#ifndef OPENSHOT_DECKLINK_WRITER_H
32#define OPENSHOT_DECKLINK_WRITER_H
33
34#include "WriterBase.h"
35
36#include <cmath>
37#include <ctime>
38#include <fcntl.h>
39#include <iostream>
40#include <omp.h>
41#include <pthread.h>
42#include <stdio.h>
43#include <stdlib.h>
44#include <string.h>
45#include <memory>
46#include <unistd.h>
47
48#include "CacheMemory.h"
49#include "Frame.h"
50#include "DecklinkOutput.h"
51
52namespace openshot
53{
54
55 /**
56 * @brief This class uses the Blackmagic Decklink libraries, to send video streams to Blackmagic devices.
57 *
58 * This requires special hardware manufactured by <a href="http://www.blackmagicdesign.com/products">Blackmagic Designs</a>.
59 * Once the device is acquired and connected, this reader returns openshot::Frame objects containing the image and audio data.
60 */
62 {
63 private:
64 bool is_open;
65
66 IDeckLink *deckLink;
67 IDeckLinkDisplayModeIterator *displayModeIterator;
68 IDeckLinkOutput *deckLinkOutput;
69 IDeckLinkVideoConversion *m_deckLinkConverter;
70 pthread_mutex_t sleepMutex;
71 pthread_cond_t sleepCond;
72 IDeckLinkIterator *deckLinkIterator;
73 DeckLinkOutputDelegate *delegate;
74 IDeckLinkDisplayMode *displayMode;
75 BMDVideoInputFlags inputFlags;
76 BMDDisplayMode selectedDisplayMode;
77 BMDPixelFormat pixelFormat;
78 int displayModeCount;
79 int exitStatus;
80 int ch;
81 bool foundDisplayMode;
82 HRESULT result;
83 int g_videoModeIndex;
84 int g_audioChannels;
85 int g_audioSampleDepth;
86 int g_maxFrames;
87 int device;
88
89 public:
90
91 /// Constructor for DecklinkWriter. This automatically opens the device or it
92 /// throws one of the following exceptions.
93 DecklinkWriter(int device, int video_mode, int pixel_format, int channels, int sample_depth);
94
95 /// Close the device and video stream
96 void Close();
97
98 /// This method is required for all derived classes of WriterBase. Write a Frame to the video file.
99 void WriteFrame(std::shared_ptr<Frame> frame);
100
101 /// This method is required for all derived classes of WriterBase. Write a block of frames from a reader.
102 void WriteFrame(ReaderBase* reader, int start, int length);
103
104 /// Open device and video stream - which is called by the constructor automatically
105 void Open();
106
107 /// Determine if writer is open or closed
108 bool IsOpen() { return is_open; };
109
110
111 };
112
113}
114
115#endif
Header file for CacheMemory class.
Header file for DecklinkOutput class.
Header file for Frame class.
Header file for WriterBase class.
Implementation of the Blackmagic Decklink API (used by the DecklinkWriter)
This class uses the Blackmagic Decklink libraries, to send video streams to Blackmagic devices.
void Close()
Close the device and video stream.
void WriteFrame(std::shared_ptr< Frame > frame)
This method is required for all derived classes of WriterBase. Write a Frame to the video file.
bool IsOpen()
Determine if writer is open or closed.
void Open()
Open device and video stream - which is called by the constructor automatically.
DecklinkWriter(int device, int video_mode, int pixel_format, int channels, int sample_depth)
This abstract class is the base class, used by all readers in libopenshot.
Definition: ReaderBase.h:98
This abstract class is the base class, used by writers. Writers are types of classes that encode vide...
Definition: WriterBase.h:88
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:47