forked from AOMediaCodec/libavif
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a public C++ header. (AOMediaCodec#1733)
Add a public C++ header. And have tests use it.
- Loading branch information
Showing
49 changed files
with
519 additions
and
515 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright 2023 Google LLC | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
|
||
#ifndef AVIF_AVIF_CXX_H | ||
#define AVIF_AVIF_CXX_H | ||
|
||
#if !defined(__cplusplus) | ||
#error "This a C++ only header. Use avif/avif.h for C." | ||
#endif | ||
|
||
#include <memory> | ||
|
||
#include "avif/avif.h" | ||
|
||
namespace avif | ||
{ | ||
|
||
// Struct to call the destroy functions in a unique_ptr. | ||
struct UniquePtrDeleter | ||
{ | ||
void operator()(avifEncoder * encoder) const { avifEncoderDestroy(encoder); } | ||
void operator()(avifDecoder * decoder) const { avifDecoderDestroy(decoder); } | ||
void operator()(avifImage * image) const { avifImageDestroy(image); } | ||
}; | ||
|
||
// Use these unique_ptr to ensure the structs are automatically destroyed. | ||
using EncoderPtr = std::unique_ptr<avifEncoder, UniquePtrDeleter>; | ||
using DecoderPtr = std::unique_ptr<avifDecoder, UniquePtrDeleter>; | ||
using ImagePtr = std::unique_ptr<avifImage, UniquePtrDeleter>; | ||
|
||
} // namespace avif | ||
|
||
#endif // AVIF_AVIF_CXX_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.