revert threading changes, they aren't ready for the mainline yet
[imager.git] / JPEG / JPEG.xs
CommitLineData
797a9f9c
TC
1#define PERL_NO_GET_CONTEXT
2#ifdef __cplusplus
3extern "C" {
4#endif
5#include "EXTERN.h"
6#include "perl.h"
7#include "XSUB.h"
8#include "imext.h"
9#include "imperl.h"
10#include "imjpeg.h"
11
12DEFINE_IMAGER_CALLBACKS;
13
14MODULE = Imager::File::JPEG PACKAGE = Imager::File::JPEG
15
16undef_int
17i_writejpeg_wiol(im, ig, qfactor)
18 Imager::ImgRaw im
19 Imager::IO ig
20 int qfactor
21
22
23void
24i_readjpeg_wiol(ig)
25 Imager::IO ig
26 PREINIT:
27 char* iptc_itext;
28 int tlength;
29 i_img* rimg;
30 SV* r;
31 PPCODE:
32 iptc_itext = NULL;
33 rimg = i_readjpeg_wiol(ig,-1,&iptc_itext,&tlength);
34 if (iptc_itext == NULL) {
35 r = sv_newmortal();
36 EXTEND(SP,1);
37 sv_setref_pv(r, "Imager::ImgRaw", (void*)rimg);
38 PUSHs(r);
39 } else {
40 r = sv_newmortal();
41 EXTEND(SP,2);
42 sv_setref_pv(r, "Imager::ImgRaw", (void*)rimg);
43 PUSHs(r);
44 PUSHs(sv_2mortal(newSVpv(iptc_itext,tlength)));
45 myfree(iptc_itext);
46 }
47
48BOOT:
49 PERL_INITIALIZE_IMAGER_CALLBACKS;