Merge tag 'LA.UM.5.8.r1-01600-8x98.0' into n-mr1
"LA.UM.5.8.r1-01600-8x98.0"
diff --git a/compress.c b/compress.c
index 555f41d..8c74a60 100644
--- a/compress.c
+++ b/compress.c
@@ -648,3 +648,35 @@
return oops(compress, EIO, "poll signalled unhandled event");
}
+int compress_get_metadata(struct compress *compress,
+ struct snd_compr_metadata *mdata) {
+ int version;
+ if (!is_compress_ready(compress))
+ return oops(compress, ENODEV, "device not ready");
+
+ version = get_compress_version(compress);
+ if (version <= 0)
+ return -1;
+
+ if (ioctl(compress->fd, SNDRV_COMPRESS_GET_METADATA, mdata)) {
+ return oops(compress, errno, "can't get metadata for stream\n");
+ }
+ return 0;
+}
+
+int compress_set_metadata(struct compress *compress,
+ struct snd_compr_metadata *mdata) {
+
+ int version;
+ if (!is_compress_ready(compress))
+ return oops(compress, ENODEV, "device not ready");
+
+ version = get_compress_version(compress);
+ if (version <= 0)
+ return -1;
+
+ if (ioctl(compress->fd, SNDRV_COMPRESS_SET_METADATA, mdata)) {
+ return oops(compress, errno, "can't set metadata for stream\n");
+ }
+ return 0;
+}
diff --git a/include/tinycompress/tinycompress.h b/include/tinycompress/tinycompress.h
index 9820d10..f88c2a2 100644
--- a/include/tinycompress/tinycompress.h
+++ b/include/tinycompress/tinycompress.h
@@ -82,6 +82,7 @@
struct compress;
struct snd_compr_tstamp;
union snd_codec_options;
+struct snd_compr_metadata;
/*
* compress_open: open a new compress stream
@@ -304,6 +305,13 @@
/* utility functions */
unsigned int compress_get_alsa_rate(unsigned int rate);
+/* set metadata */
+int compress_set_metadata(struct compress *compress,
+ struct snd_compr_metadata *mdata);
+
+/* get metadata */
+int compress_get_metadata(struct compress *compress,
+ struct snd_compr_metadata *mdata);
#if defined(__cplusplus)
}