-
Notifications
You must be signed in to change notification settings - Fork 1
/
decoderjob.hpp
70 lines (56 loc) · 1.25 KB
/
decoderjob.hpp
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef DECODERJOB_HPP
#define DECODERJOB_HPP
class Frame;
#include <stdlib.h>
#include <pthread.h>
#include "libmpeg2.h"
#include "exceptions.hpp"
#include "picture.hpp"
enum DecodeDirection { TOPDOWN, BOTTOMUP };
class DecoderJob
{
public:
virtual void execute( void ) = 0;
virtual ~DecoderJob() {}
};
class DecodeSlices : public DecoderJob
{
public:
Picture *picture;
DecodeDirection direction;
mpeg2_decoder_t *decoder;
Frame *cur, *fwd, *back;
DecodeSlices( Picture *s_picture, DecodeDirection s_direction,
mpeg2_decoder_t *s_decoder,
Frame *s_cur, Frame *s_fwd, Frame *s_back )
: picture( s_picture ), direction( s_direction ), decoder( s_decoder ),
cur( s_cur ), fwd( s_fwd ), back( s_back )
{}
void execute( void ) {
picture->decoder_internal( this );
}
~DecodeSlices() {
free( decoder );
}
};
class Cleanup : public DecoderJob
{
private:
Picture *picture;
bool leave_locked;
public:
Cleanup( Picture *s_picture, bool s_leave_locked )
: picture( s_picture ), leave_locked( s_leave_locked )
{}
void execute( void ) {
picture->decoder_cleanup_internal( leave_locked );
}
};
class DecoderJobShutDown : public DecoderJob
{
public:
void execute( void ) {
pthread_exit( NULL );
}
};
#endif