summaryrefslogtreecommitdiff
path: root/src/liana
diff options
context:
space:
mode:
Diffstat (limited to 'src/liana')
-rw-r--r--src/liana/client.c13
-rw-r--r--src/liana/handlers/codec_client.c2
-rw-r--r--src/liana/handlers/codec_server.c2
-rw-r--r--src/liana/process.c8
-rw-r--r--src/liana/vcr.c6
5 files changed, 20 insertions, 11 deletions
diff --git a/src/liana/client.c b/src/liana/client.c
index 164a4d1..626a752 100644
--- a/src/liana/client.c
+++ b/src/liana/client.c
@@ -27,7 +27,12 @@ static void data_packet_callback(void *userdata, struct nn_packet_stream *stream
static s32 stream_compare(const void *a, const void *b)
{
- return (s32)((struct camu_codec_stream *)a)->type - (s32)((struct camu_codec_stream *)b)->type;
+ struct camu_codec_stream *aa = (struct camu_codec_stream *)a;
+ struct camu_codec_stream *bb = (struct camu_codec_stream *)b;
+ if (aa->type == bb->type) {
+ return aa->index - bb->index;
+ }
+ return aa->type - bb->type;
}
static void collect_streams(struct lia_client *client, struct nn_packet *packet)
@@ -49,7 +54,7 @@ static void collect_streams(struct lia_client *client, struct nn_packet *packet)
fmt->sample_rate = nn_packet_read_s32(packet);
fmt->channel_count = nn_packet_read_s32(packet);
#ifdef CAMU_HAVE_FFMPEG
- av_channel_layout_default(&fmt->channel_layout, fmt->channel_count);
+ camu_default_channel_layout(&fmt->channel_layout, fmt->channel_count);
#endif
} else if (type == CAMU_STREAM_VIDEO) {
struct camu_video_format *fmt = &stream.video.fmt;
@@ -80,8 +85,8 @@ static void collect_streams(struct lia_client *client, struct nn_packet *packet)
struct camu_audio_format *fmt = &stream.audio.fmt;
fmt->format = codecpar->format;
fmt->sample_rate = codecpar->sample_rate;
- av_channel_layout_copy(&fmt->channel_layout, &codecpar->ch_layout);
- fmt->channel_count = codecpar->ch_layout.nb_channels;
+ camu_copy_channel_layout(&fmt->channel_layout, &AV_CODECPAR_CHANNEL_LAYOUT(codecpar));
+ fmt->channel_count = AV_CODECPAR_CHANNELS(codecpar);
break;
}
case CAMU_STREAM_VIDEO: {
diff --git a/src/liana/handlers/codec_client.c b/src/liana/handlers/codec_client.c
index fd2569b..38b5d3b 100644
--- a/src/liana/handlers/codec_client.c
+++ b/src/liana/handlers/codec_client.c
@@ -132,9 +132,9 @@ static bool codec_client_handle_packet(struct lia_client_handler *handler, struc
#endif
break;
}
+#endif
default:
al_assert_and_return(false);
-#endif
}
// Restore packet rindex in case we resue it.
diff --git a/src/liana/handlers/codec_server.c b/src/liana/handlers/codec_server.c
index de2c927..3b7d31e 100644
--- a/src/liana/handlers/codec_server.c
+++ b/src/liana/handlers/codec_server.c
@@ -149,7 +149,7 @@ static void codec_server_write_packet(struct lia_server_handler *handler, struct
nn_packet_write_u8(packet, LIANA_PACKET_EOF);
#ifdef LIANA_SERVER_LOOP
codec->pts_offset += codec->demux->get_duration(codec->demux);
- codec->demux->seek(codec->demux, 0);
+ codec->demux->seek(codec->demux, 0, false);
#endif
} else {
nn_packet_write_u8(packet, LIANA_PACKET_ERROR);
diff --git a/src/liana/process.c b/src/liana/process.c
index 0a6d6b6..a8b57d0 100644
--- a/src/liana/process.c
+++ b/src/liana/process.c
@@ -65,10 +65,10 @@ bool lia_prepare_visual_data(struct cch_handle *handle, struct lia_visual_data *
fmt.req.format = CAMU_SAMPLE_FORMAT_S16;
fmt.in.sample_rate = codecpar->sample_rate;
fmt.req.sample_rate = codecpar->sample_rate;
- av_channel_layout_copy(&fmt.in.channel_layout, &codecpar->ch_layout);
- av_channel_layout_copy(&fmt.req.channel_layout, &codecpar->ch_layout);
- fmt.in.channel_count = codecpar->ch_layout.nb_channels;
- fmt.req.channel_count = codecpar->ch_layout.nb_channels;
+ camu_copy_channel_layout(&fmt.in.channel_layout, &AV_CODECPAR_CHANNEL_LAYOUT(codecpar));
+ camu_copy_channel_layout(&fmt.req.channel_layout, &AV_CODECPAR_CHANNEL_LAYOUT(codecpar));
+ fmt.in.channel_count = AV_CODECPAR_CHANNELS(codecpar);
+ fmt.req.channel_count = AV_CODECPAR_CHANNELS(codecpar);
struct raw_samples_data raw;
raw.resampler = resampler;
diff --git a/src/liana/vcr.c b/src/liana/vcr.c
index 4500681..78c2b9c 100644
--- a/src/liana/vcr.c
+++ b/src/liana/vcr.c
@@ -126,9 +126,11 @@ static nn_thread_result NNWT_THREADCALL vcr_track_thread(void *userdata)
continue;
}
- index++; // Count of packets consumed.
+ index++; // Count of packets consumed, also increment for WHOLE_FILE mode.
+#ifndef VCR_BUFFER_WHOLE_FILE
nn_packet_stream_return_packets(vcr->data, al_array_offset(track->cache.cache, 0), index);
al_array_remove_range(track->cache.cache, 0, index);
+#endif
nn_packet_cache_unlock(&track->cache);
@@ -153,7 +155,9 @@ static nn_thread_result NNWT_THREADCALL vcr_track_thread(void *userdata)
if (corked) {
// The cache is already unlocked here.
+#ifndef VCR_BUFFER_WHOLE_FILE
index = 0;
+#endif
} else {
#ifndef VCR_BUFFER_WHOLE_FILE
al_assert(index == packets);