diff options
Diffstat (limited to 'src/liana/handlers')
| -rw-r--r-- | src/liana/handlers/codec_client.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/liana/handlers/codec_client.c b/src/liana/handlers/codec_client.c index 36e475e..8a86799 100644 --- a/src/liana/handlers/codec_client.c +++ b/src/liana/handlers/codec_client.c @@ -43,6 +43,13 @@ static bool push_av_packet(struct lia_codec_client *codec, AVPacket *pkt) s32 ret = codec->dec->push_av_packet(codec->dec, pkt); return ret == CAMU_OK; } + +static void passthrough_subtitle(struct lia_codec_client *codec, AVPacket *pkt) +{ + struct camu_codec_packet packet = { .av.pkt = pkt }; + struct camu_codec_stream *stream = codec->handler.stream; + codec->handler.callback(codec->handler.userdata, LIANA_CLIENT_SUBTITLE, stream, &packet); +} #endif static bool push_packet(struct lia_codec_client *codec, struct nn_buffer *buffer) @@ -109,15 +116,16 @@ static bool codec_client_handle_packet(struct lia_client_handler *handler, struc nn_packet_read_av_packet(packet, pkt); packet->opaque = pkt; } - struct camu_codec_stream *stream = codec->handler.stream; if (codec->dec) { success = push_av_packet(codec, pkt); } else { - codec->handler.callback(codec->handler.userdata, LIANA_CLIENT_SUBTITLE, stream, pkt); + passthrough_subtitle(codec, pkt); success = true; } #ifdef VCR_BUFFER_WHOLE_FILE - pkt->pts += av_rescale_q(stream->duration, AV_TIME_BASE_Q, stream->av.stream->time_base); + struct camu_codec_stream *stream = codec->handler.stream; + AVRational time_base = stream->av.stream->time; + pkt->pts += av_rescale_q(stream->duration, AV_TIME_BASE_Q, time_base); #else av_packet_unref(pkt); av_packet_free(&pkt); |