v0.1.0 - First semver release, with changelog
diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 0000000..8df4b76
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,17 @@
+# Changelog
+All notable changes to this project will be documented in this file.
+
+The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
+and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+
+## [Unreleased]
+
+## [0.1.0] - 2019-04-12
+### Added
+- First version. Plenty of bugfixes and features await!
+- An interest and willingness to maintain this file.
+- Creation of constants AVIF_VERSION(_MAJOR/_MINOR_/_PATCH)
+- Creation of `avifVersion()` function
+
+[Unreleased]: https://github.com/joedrago/avif/compare/v0.1.0...HEAD
+[0.1.0]: https://github.com/joedrago/avif/releases/tag/v0.1.0
diff --git a/examples/avif_example1.c b/examples/avif_example1.c
index 3d36a41..a1fa0df 100644
--- a/examples/avif_example1.c
+++ b/examples/avif_example1.c
@@ -11,6 +11,8 @@
(void)argc;
(void)argv;
+ printf("avif version: %s\n", avifVersion());
+
#if 1
int width = 32;
int height = 32;
diff --git a/include/avif/avif.h b/include/avif/avif.h
index 4b1953b..d40e78c 100644
--- a/include/avif/avif.h
+++ b/include/avif/avif.h
@@ -7,9 +7,18 @@
#include <stddef.h>
#include <stdint.h>
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// ---------------------------------------------------------------------------
// Constants
+#define AVIF_VERSION_MAJOR 0
+#define AVIF_VERSION_MINOR 1
+#define AVIF_VERSION_PATCH 0
+#define AVIF_VERSION (AVIF_VERSION_MAJOR * 10000) + (AVIF_VERSION_MINOR * 100) + AVIF_VERSION_PATCH
+
typedef int avifBool;
#define AVIF_TRUE 1
#define AVIF_FALSE 0
@@ -46,6 +55,8 @@
// ---------------------------------------------------------------------------
// Utils
+const char * avifVersion();
+
// Yes, clamp macros are nasty. Do not use them.
#define AVIF_CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
@@ -315,4 +326,8 @@
// Helpers
avifBool avifImageUsesU16(avifImage * image);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // ifndef AVIF_AVIF_H
diff --git a/include/avif/internal.h b/include/avif/internal.h
index 7a493ca..609ed9b 100644
--- a/include/avif/internal.h
+++ b/include/avif/internal.h
@@ -6,6 +6,10 @@
#include "avif/avif.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
// Yes, clamp macros are nasty. Do not use them.
#define AVIF_CLAMP(x, low, high) (((x) > (high)) ? (high) : (((x) < (low)) ? (low) : (x)))
@@ -145,4 +149,8 @@
void avifStreamWriteU32(avifStream * stream, uint32_t v);
void avifStreamWriteZeros(avifStream * stream, size_t byteCount);
+#ifdef __cplusplus
+} // extern "C"
+#endif
+
#endif // ifndef AVIF_INTERNAL_H
diff --git a/src/avif.c b/src/avif.c
index 152b21b..e8be4f4 100644
--- a/src/avif.c
+++ b/src/avif.c
@@ -5,6 +5,15 @@
#include <string.h>
+#define STR_HELPER(x) #x
+#define STR(x) STR_HELPER(x)
+#define AVIF_VERSION_STRING (STR(AVIF_VERSION_MAJOR) "." STR(AVIF_VERSION_MINOR) "." STR(AVIF_VERSION_PATCH))
+
+const char * avifVersion()
+{
+ return AVIF_VERSION_STRING;
+}
+
void avifGetPixelFormatInfo(avifPixelFormat format, avifPixelFormatInfo * info)
{
memset(info, 0, sizeof(avifPixelFormatInfo));