2
0

stream.c 789 B

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