Add GAsyncReadyCallback to the introspection API. This makes it possible
to report errors in the future. Don't pass NULL in the callback anymore
now that we have the Ready callback. We also don't need to have a return
value from the callback because now we can cancel any iteration by using
the GCancelable.
Make pinos_context_info_finish() to get the final result/error of
introspection.
Update tools for new API
Check if we got tmpfile memory and if we do, don't bother waiting for
the release-fd message but unref the memory directly. We know the memory
is allocated from our allocator and that we won't reuse it.
Track the fd indices we sent to Pinos and free the associated buffer
when Pinos sends us release-fd. Only do this for non tempfile fds, as we
made the tmpfile ones ourselves and we're not going to reuse them.
Handle application/x-pinos specially; track all the fd indices in the
buffers and send a release-fd message when the buffer is freed.
We can then use the payloader also in the client-source to handle the
release-fd messages correctly.
The caps we stream between the src and sink are always
application/x-pinos. Keep the negotiated format ouside of the
capsfilter in a separate variable. We can then also avoid a query
to get the format.
If we are using the original buffer fd without copying it into a temp
file we need to make sure the memory stays alive and is not reused until
all clients are done with it.
To do this, track what fd ids are in the outgoing buffers and ref the
original buffer. We also need to know when a message is sent to a client
and when that client does a release-fd on the fd index. This is done
with some new events on the multisocketsink.
Every time a message is sent to a client we hash the fd index in it and
ref the buffer in a per-client hash table (on the socket). Every time we
receive release-fd we remove the fd index from the hash and unref the
buffer again.
Clients that are killed get their socket removed, which also cleans up
the hashtable and frees the memory again.
Make separate payload for the header.
Make release-fd payloads
capture_buffer -> peek_buffer to avoid a copy
remove release-buffer, we really need to release each fd in the buffer
separately.
provide_buffer -> send_buffer so that we can also use this to send the
release-fd messages.
in pinossrc, send back release-fd messages when the fd is no longer in
use.
Rename the payloader and depayloader to pinospay/pinosdepay because they
now store data in a pinos specific format.
Subclass GstElement because they are not real transform elements.
Rework/remove some buffer functions that are not used by some more
performant ones.
Use BufferIter and BufferBuilder instead of Packet*
Make separate method to set the header so you can set it later and not
only at builder init time.
Add method to clear the builder if you want to abort.
Add method to add fd to builder instead of in _add_fd_payload. This
would make it easier to add multiple fd-payloads using data from the
same fd.
Pass PinosPacketFDPayload to add_fd_payload to make it symetric with the
parsing code. We should be able to get the size from the VERSION passed
when the builder was made.
Add ideas about releasing the fds back to the server.