Skip to content

Commit 4f927e8

Browse files
authored
Add avifRGBImage to the C++ API (AOMediaCodec#3042)
1 parent 4204ec7 commit 4f927e8

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

include/avif/avif_cxx.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,20 @@ namespace avif
1818
// Struct to call the destroy functions in a unique_ptr.
1919
struct UniquePtrDeleter
2020
{
21-
void operator()(avifEncoder * encoder) const { avifEncoderDestroy(encoder); }
2221
void operator()(avifDecoder * decoder) const { avifDecoderDestroy(decoder); }
23-
void operator()(avifImage * image) const { avifImageDestroy(image); }
22+
void operator()(avifEncoder * encoder) const { avifEncoderDestroy(encoder); }
2423
void operator()(avifGainMap * gainMap) const { avifGainMapDestroy(gainMap); }
24+
void operator()(avifImage * image) const { avifImageDestroy(image); }
25+
void operator()(avifRGBImage * image) const { avifRGBImageFreePixels(image); }
2526
};
2627

2728
// Use these unique_ptr to ensure the structs are automatically destroyed.
28-
using EncoderPtr = std::unique_ptr<avifEncoder, UniquePtrDeleter>;
2929
using DecoderPtr = std::unique_ptr<avifDecoder, UniquePtrDeleter>;
30-
using ImagePtr = std::unique_ptr<avifImage, UniquePtrDeleter>;
30+
using EncoderPtr = std::unique_ptr<avifEncoder, UniquePtrDeleter>;
3131
using GainMapPtr = std::unique_ptr<avifGainMap, UniquePtrDeleter>;
32+
using ImagePtr = std::unique_ptr<avifImage, UniquePtrDeleter>;
33+
// To use when RGBImage actually owns the pixels. RGBImage can also be used as a view, in which case it does not own the pixels.
34+
using RGBImagePtr = std::unique_ptr<avifRGBImage, UniquePtrDeleter>;
3235

3336
} // namespace avif
3437

0 commit comments

Comments
 (0)