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