Make stream push packets to sinks

Now that decoder and recorder implement the packet sink trait, make
stream push packets to the sinks without depending on the concrete sink
types.
This commit is contained in:
Romain Vimont
2021-04-11 15:01:05 +02:00
parent cbed38799e
commit f7a1b67d66
7 changed files with 82 additions and 65 deletions

View File

@@ -41,8 +41,14 @@ decoder_close(struct decoder *decoder) {
avcodec_free_context(&decoder->codec_ctx);
}
bool
static bool
decoder_push(struct decoder *decoder, const AVPacket *packet) {
bool is_config = packet->pts == AV_NOPTS_VALUE;
if (is_config) {
// nothing to do
return true;
}
int ret;
if ((ret = avcodec_send_packet(decoder->codec_ctx, packet)) < 0) {
LOGE("Could not send video packet: %d", ret);