summaryrefslogtreecommitdiff
path: root/compress.c
diff options
context:
space:
mode:
authorAniket Kumar Lata <alata@quicinc.com>2019-01-18 16:45:01 -0800
committerEric Laurent <elaurent@google.com>2019-02-08 16:59:28 -0800
commit8751cecd805318f37a99fa241d6e86b607c0d00e (patch)
tree60eb05f2e88de4fce5c0d1574244d042b1357998 /compress.c
parentf7c2a4b1b433eedf287a49af69864d49622e93e1 (diff)
tinycompress: tinycompress fixes
- Add get_metadata() and set_metadata() API support - Add support to send codec specific data Bug: 123065627 Test: make Change-Id: I9c3f39e22d7246fbb7cf665a4b5ce71a74e07495
Diffstat (limited to 'compress.c')
-rw-r--r--compress.c47
1 files changed, 47 insertions, 0 deletions
diff --git a/compress.c b/compress.c
index d1a2283..5845cae 100644
--- a/compress.c
+++ b/compress.c
@@ -572,6 +572,19 @@ int compress_set_gapless_metadata(struct compress *compress,
return 0;
}
+#ifdef ENABLE_EXTENDED_COMPRESS_FORMAT
+int compress_set_next_track_param(struct compress *compress,
+ union snd_codec_options *codec_options)
+{
+ if (!is_compress_running(compress))
+ return oops(compress, ENODEV, "device not ready");
+
+ if (ioctl(compress->fd, SNDRV_COMPRESS_SET_NEXT_TRACK_PARAM, codec_options))
+ return oops(compress, errno, "cannot set next track params\n");
+ return 0;
+}
+#endif
+
bool is_codec_supported(unsigned int card, unsigned int device,
unsigned int flags, struct snd_codec *codec)
{
@@ -630,3 +643,37 @@ int compress_wait(struct compress *compress, int timeout_ms)
return oops(compress, EIO, "poll signalled unhandled event");
}
+#ifdef ENABLE_EXTENDED_COMPRESS_FORMAT
+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;
+}
+#endif