summaryrefslogtreecommitdiff
path: root/src/lib/j2k_sync_encoder_thread.h
blob: 06bb1fcefb64bbad7684c443a695a78f5ebaa86c (plain)
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
31
32
33
34
35
36
37
#ifndef DCPOMATIC_J2K_SYNC_ENCODER_THREAD_H
#define DCPOMATIC_J2K_SYNC_ENCODER_THREAD_H


#include "exception_store.h"
#include "j2k_encoder_thread.h"
#include <dcp/array_data.h>
#include <boost/thread.hpp>


class DCPVideo;
class J2KEncoder;


class J2KSyncEncoderThread : public J2KEncoderThread, public ExceptionStore
{
public:
	J2KSyncEncoderThread(J2KEncoder& encoder);

	J2KSyncEncoderThread(J2KSyncEncoderThread const&) = delete;
	J2KSyncEncoderThread& operator=(J2KSyncEncoderThread const&) = delete;

	virtual ~J2KSyncEncoderThread() {}

	void run() override;

	virtual void log_thread_start() const = 0;
	virtual std::shared_ptr<dcp::ArrayData> encode(DCPVideo const& frame) = 0;
	/** @return number of seconds we should wait between attempts to use this thread
	 *  for encoding. Used to avoid flooding non-responsive network servers with
	 *  requests.
	 */
	virtual int backoff() const { return 0; }
};


#endif