-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathSkImageEncoder_libtijpeg_entry.h
100 lines (86 loc) · 3.06 KB
/
SkImageEncoder_libtijpeg_entry.h
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*
* Copyright (C) Texas Instruments - http://www.ti.com/
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/* ==============================================================================
* Texas Instruments OMAP (TM) Platform Software
* (c) Copyright Texas Instruments, Incorporated. All Rights Reserved.
*
* Use of this software is controlled by the terms and conditions found
* in the license agreement under which this software has been supplied.
* ============================================================================ */
#ifndef SKIAHW_ENCODER_ENTRY_H
#define SKIAHW_ENCODER_ENTRY_H
#include <string.h>
#include "SkBitmap.h"
#include "SkStream.h"
#include "SkTemplates.h"
#include "SkImageEncoder.h"
#include "SkImageEncoder_libtijpeg.h"
#include "SkImageUtility.h"
#include <stdio.h>
#include <semaphore.h>
#include <utils/threads.h>
#include <utils/List.h>
extern "C" {
#include "OMX_Component.h"
#include "OMX_IVCommon.h"
}
class SkTIJPEGImageEncoderEntry;
typedef WatchdogThread<SkTIJPEGImageEncoderEntry> EncoderWatchdog;
class SkTIJPEGImageEncoderList_Item
{
public:
SkTIJPEGImageEncoder* Encoder;
android::sp<EncoderWatchdog> WatchdogTimer;
};
class SkTIJPEGImageEncoderListWrapper
{
public:
SkTIJPEGImageEncoderListWrapper() {}
~SkTIJPEGImageEncoderListWrapper(){
while(list.begin() != list.end())
{
android::List<SkTIJPEGImageEncoderList_Item*>::iterator iter = list.begin();
SkTIJPEGImageEncoderList_Item* item = static_cast<SkTIJPEGImageEncoderList_Item*>(*iter);
SkAutoTDelete<SkTIJPEGImageEncoder> autodelete(item->Encoder);
item->WatchdogTimer.clear();
SkDebugf("SkTIJPEGImageEncoder Cleanup: 0x%x", item);
list.erase(iter);
}
}
android::List<SkTIJPEGImageEncoderList_Item*> list;
};
class SkTIJPEGImageEncoderEntry :public SkImageEncoder
{
friend class WatchdogThread<SkTIJPEGImageEncoderEntry>;
protected:
virtual bool onEncode(SkWStream* stream, const SkBitmap& bm, int quality);
public:
SkTIJPEGImageEncoderEntry();
~SkTIJPEGImageEncoderEntry();
private:
bool WatchdogCallback(void* param);
};
extern "C" SkImageEncoder* SkImageEncoder_HWJPEG_Factory() {
return SkNEW(SkTIJPEGImageEncoderEntry);
}
extern "C" SkTIJPEGImageEncoderEntry* SkImageEncoder_TIJPEG_Factory() {
return SkNEW(SkTIJPEGImageEncoderEntry);
}
#endif