stream.c 786 B

12345678910111213141516171819202122232425262728293031323334
  1. #include "qemu/osdep.h"
  2. #include "hw/stream.h"
  3. #include "qemu/module.h"
  4. size_t
  5. stream_push(StreamSlave *sink, uint8_t *buf, size_t len)
  6. {
  7. StreamSlaveClass *k = STREAM_SLAVE_GET_CLASS(sink);
  8. return k->push(sink, buf, len);
  9. }
  10. bool
  11. stream_can_push(StreamSlave *sink, StreamCanPushNotifyFn notify,
  12. void *notify_opaque)
  13. {
  14. StreamSlaveClass *k = STREAM_SLAVE_GET_CLASS(sink);
  15. return k->can_push ? k->can_push(sink, notify, notify_opaque) : true;
  16. }
  17. static const TypeInfo stream_slave_info = {
  18. .name = TYPE_STREAM_SLAVE,
  19. .parent = TYPE_INTERFACE,
  20. .class_size = sizeof(StreamSlaveClass),
  21. };
  22. static void stream_slave_register_types(void)
  23. {
  24. type_register_static(&stream_slave_info);
  25. }
  26. type_init(stream_slave_register_types)