Flutter Engine
The Flutter Engine
Functions
SkJpegXmp.h File Reference
#include "include/core/SkRefCnt.h"
#include "include/private/SkXmp.h"
#include <memory>
#include <vector>

Go to the source code of this file.

Functions

std::unique_ptr< SkXmpSkJpegMakeXmp (const std::vector< sk_sp< SkData > > &decoderApp1Params)
 

Function Documentation

◆ SkJpegMakeXmp()

std::unique_ptr< SkXmp > SkJpegMakeXmp ( const std::vector< sk_sp< SkData > > &  decoderApp1Params)

Definition at line 181 of file SkJpegXmp.cpp.

181 {
182 auto xmpStandard = read_xmp_standard(decoderApp1Params);
183 if (!xmpStandard) {
184 return nullptr;
185 }
186
187 std::unique_ptr<SkXmp> xmp = SkXmp::Make(xmpStandard);
188 if (!xmp) {
189 return nullptr;
190 }
191
192 // Extract the GUID (the MD5 hash) of the extended metadata.
193 const char* extendedGuid = xmp->getExtendedXmpGuid();
194 if (!extendedGuid) {
195 return xmp;
196 }
197
198 // Extract and validate the extended metadata from the JPEG structure.
199 auto xmpExtended = read_xmp_extended(decoderApp1Params, extendedGuid);
200 if (!xmpExtended) {
201 SkCodecPrintf("Extended XMP was indicated but failed to read or validate.\n");
202 return xmp;
203 }
204
205 return SkXmp::Make(xmpStandard, xmpExtended);
206}
#define SkCodecPrintf(...)
Definition: SkCodecPriv.h:23
static sk_sp< SkData > read_xmp_standard(const std::vector< sk_sp< SkData > > &decoderApp1Params)
Definition: SkJpegXmp.cpp:27
static sk_sp< SkData > read_xmp_extended(const std::vector< sk_sp< SkData > > &decoderApp1Params, const char *guidAscii)
Definition: SkJpegXmp.cpp:56
static std::unique_ptr< SkXmp > Make(sk_sp< SkData > xmpData)
Definition: SkXmp.cpp:652