stream.c 737 B

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