*
*/
+#include <inttypes.h>
#include "gstmaru.h"
#include "gstmaruinterface.h"
#include "gstmaruutils.h"
typedef struct {
uint32_t api_index;
uint32_t ctx_index;
- uint32_t mem_offset;
+ uintptr_t mem_offset;
int32_t buffer_size;
} __attribute__((packed)) IOCTL_Data;
#define IOCTL_RW(CMD) (_IOWR(BRILLCODEC_KEY, CMD, IOCTL_Data))
#define CODEC_META_DATA_SIZE 256
-#define GET_OFFSET(buffer) ((uint32_t)buffer - (uint32_t)device_mem)
+#define GET_OFFSET(buffer) ((uintptr_t)buffer - (uintptr_t)device_mem)
#define SMALLDATA 0
#define OFFSET_PICTURE_BUFFER 0x100
static int
invoke_device_api(int fd, int32_t ctx_index, int32_t api_index,
- uint32_t *mem_offset, int32_t buffer_size)
+ uintptr_t *mem_offset, int32_t buffer_size)
{
GST_DEBUG (" >> Enter");
IOCTL_Data ioctl_data = { 0, };
ret = ioctl (fd, IOCTL_RW(IOCTL_CMD_SECURE_BUFFER), &data);
- *buffer = (gpointer)((uint32_t)device_mem + data.mem_offset);
- GST_DEBUG ("device_mem %p, offset_size 0x%x", device_mem, data.mem_offset);
+ *buffer = (gpointer)(device_mem + data.mem_offset);
+ GST_DEBUG ("device_mem %p, offset_size 0x%"PRIXPTR, device_mem, data.mem_offset);
GST_DEBUG (" >> Leave");
return ret;
int opened = 0;
gpointer buffer = NULL;
int ret;
- uint32_t mem_offset;
+ uintptr_t mem_offset;
GST_DEBUG (" >> Enter");
if ((ctx->index = get_context_index(dev->fd)) <= 0) {
CodecDevice *dev = marudec->dev;
int len = 0, ret = 0;
gpointer buffer = NULL;
- uint32_t mem_offset;
+ uintptr_t mem_offset;
size_t size = sizeof(inbuf_size) + sizeof(idx) + sizeof(in_offset) + inbuf_size;
ret = secure_device_mem(dev->fd, ctx->index, size, &buffer);
{
GST_DEBUG (" >> enter");
bool is_last_buffer = 0;
- uint32_t mem_offset;
+ uintptr_t mem_offset;
CodecContext *ctx;
CodecDevice *dev;
GstMapInfo mapinfo;
}
- GST_DEBUG ("device memory start: 0x%p, offset 0x%x", (void *) buffer, mem_offset);
+ GST_DEBUG ("device memory start: 0x%p, offset 0x%"PRIXPTR, (void *) buffer, mem_offset);
}
gst_buffer_unmap (*buf, &mapinfo);
{
GST_DEBUG (" >> enter");
bool is_last_buffer = 0;
- uint32_t mem_offset;
+ uintptr_t mem_offset;
GstMaruDec *marudec;
CodecContext *ctx;
CodecDevice *dev;
}
- GST_DEBUG ("device memory start: 0x%p, offset 0x%x", (void *) buffer, mem_offset);
+ GST_DEBUG ("device memory start: 0x%p, offset 0x%"PRIXPTR, (void *) buffer, mem_offset);
}
*buf = gst_buffer_new ();
{
int len = 0, ret = 0;
gpointer buffer = NULL;
- uint32_t mem_offset;
+ uintptr_t mem_offset;
size_t size = sizeof(inbuf_size) + sizeof(in_timestamp) + inbuf_size;
ret = secure_device_mem(dev->fd, ctx->index, size, &buffer);
return -1;
}
- GST_DEBUG ("encode_video. mem_offset = 0x%x", mem_offset);
+ GST_DEBUG ("encode_video. mem_offset = 0x%"PRIXPTR, mem_offset);
struct video_encode_output *encode_output = device_mem + mem_offset;
len = encode_output->len;
{
int len = 0, ret = 0;
gpointer buffer = NULL;
- uint32_t mem_offset;
+ uintptr_t mem_offset;
size_t size = sizeof(inbuf_size) + inbuf_size;
ret = secure_device_mem(dev->fd, ctx->index, size, &buffer);
return -1;
}
- GST_DEBUG ("decode_audio. ctx_id: %d, buffer = 0x%x",
- ctx->index, (unsigned int) (device_mem + mem_offset));
+ GST_DEBUG ("decode_audio. ctx_id: %d, buffer = 0x%p",
+ ctx->index, device_mem + mem_offset);
struct audio_decode_output *decode_output = device_mem + mem_offset;
len = decode_output->len;
memcpy (samples, device_mem + mem_offset + OFFSET_PICTURE_BUFFER, len);
- GST_DEBUG ("decode_audio. sample_fmt %d sample_rate %d, channels %d, ch_layout %lld, len %d",
+ GST_DEBUG ("decode_audio. sample_fmt %d sample_rate %d, channels %d, ch_layout %" PRIu64 ", len %d",
ctx->audio.sample_fmt, ctx->audio.sample_rate, ctx->audio.channels,
ctx->audio.channel_layout, len);
{
int len = 0, ret = 0;
gpointer buffer = NULL;
- uint32_t mem_offset;
+ uintptr_t mem_offset;
size_t size = sizeof(inbuf_size) + inbuf_size;
ret = secure_device_mem(dev->fd, ctx->index, inbuf_size, &buffer);
return -1;
}
- GST_DEBUG ("encode_audio. mem_offset = 0x%x", mem_offset);
+ GST_DEBUG ("encode_audio. mem_offset = 0x%"PRIXPTR, mem_offset);
struct audio_encode_output *encode_output = device_mem + mem_offset;
len = encode_output->len;