1 /* rawv video source & sink interfaces, helpers
2 * Copyright (C) 2012 Kirill Smelkov <kirr@navytux.spb.ru>
4 * This library is free software: you can Use, Study, Modify and Redistribute
5 * it under the terms of the GNU Lesser General Public License version 2.1, or
6 * any later version. This library is distributed WITHOUT ANY WARRANTY. See
7 * COPYING.LIB file for full License terms.
15 IVideoSink::~IVideoSink()
18 IVideoSource::~IVideoSource()
23 VideoSource::VideoSource()
28 VideoSource::~VideoSource()
32 void VideoSource::notify_v_subscribers(const Frame
*f
)
36 for (i
=0; i
<v_subscribers
.size(); ++i
) {
37 IVideoSink
*vs
= v_subscribers
[i
];
39 /* sink which provided framebuffer should be notified last */
47 vs_sinkbuf
->v_on_frame(f
);
53 bool VideoSource::query_sink_framebuf(Frame
*f
)
60 die("VideoSource->query_sink_framebuf(): sinkbuf was already queried");
63 for (i
=0; i
<v_subscribers
.size(); ++i
) {
64 vs
= v_subscribers
[i
];
66 ok
= vs
->v_query_framebuf(f
);
77 void VideoSource::v_subscribe(IVideoSink
*vs
)
79 v_subscribers
.push_back(vs
);
83 void VideoSource::v_unsubscribe(IVideoSink
*vs
)
85 /* TODO handle unsubscribe of framebuf provider */
87 die("TODO VideoSource: handle vs_sinkbuf unsubscription");
89 for (vector
<IVideoSink
*>::iterator it
=v_subscribers
.begin(); it
!= v_subscribers
.end();) {
91 v_subscribers
.erase(it
);