+ } else {
+ /* Capture data is chunked, advance to the next chunk. */
+ vdev->cur_chunk++;
+ snprintf(capturefile, 15, "%s-%d", vdev->capturefile,
+ vdev->cur_chunk);
+ if (zip_stat(vdev->archive, capturefile, 0, &zs) != -1) {
+ if (!(vdev->capfile = zip_fopen(vdev->archive,
+ capturefile, 0)))
+ return FALSE;
+ sr_dbg("Opened %s.", capturefile);
+ } else if (vdev->cur_analog_channel < vdev->num_analog_channels) {
+ vdev->capturefile = g_strdup_printf("analog-1-%d",
+ vdev->num_logic_channels + vdev->cur_analog_channel + 1);
+ vdev->cur_analog_channel++;
+ vdev->cur_chunk = 0;
+ return TRUE;
+ } else {
+ /* We got all the chunks, finish up. */
+ g_free(vdev->capturefile);
+
+ /* If the file has logic channels, the initial value for
+ * capturefile is set by stream_session_data() - however only
+ * once. In order to not mess this mechanism up, we simulate
+ * this here if needed. For purely analog files, capturefile
+ * is not set.
+ */
+ if (vdev->num_logic_channels)
+ vdev->capturefile = g_strdup("logic-1");
+ else
+ vdev->capturefile = NULL;
+ return FALSE;
+ }