From b7c807a85ca104b21ff42b0a69c31d2440253b79 Mon Sep 17 00:00:00 2001 From: bnnm Date: Sat, 12 Aug 2017 11:27:10 +0200 Subject: [PATCH] Add stream name string, for metas than can use it --- src/vgmstream.c | 18 +++++++++++++++++- src/vgmstream.h | 7 ++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/vgmstream.c b/src/vgmstream.c index 3218aa34..fb722f13 100644 --- a/src/vgmstream.c +++ b/src/vgmstream.c @@ -446,6 +446,9 @@ VGMSTREAM * init_vgmstream_internal(STREAMFILE *streamFile, int do_dfs) { } #endif + /* save info */ + vgmstream->stream_index = streamFile->stream_index; + /* save start things so we can restart for seeking */ /* copy the channels */ memcpy(vgmstream->start_ch,vgmstream->ch,sizeof(VGMSTREAMCHANNEL)*vgmstream->channels); @@ -2052,10 +2055,23 @@ void describe_vgmstream(VGMSTREAM * vgmstream, char * desc, int length) { /* only interesting if more than one */ if (vgmstream->num_streams > 1) { snprintf(temp,TEMPSIZE, - "\nnumber of streams: %d", + "\nstream number: %d", vgmstream->num_streams); concatn(length,desc,temp); } + + if (vgmstream->num_streams > 1 && vgmstream->stream_index > 0) { + snprintf(temp,TEMPSIZE, + "\nstream index: %d", + vgmstream->stream_index); + concatn(length,desc,temp); + } + if (vgmstream->stream_name[0] != '\0') { + snprintf(temp,TEMPSIZE, + "\nstream name: %s", + vgmstream->stream_name); + concatn(length,desc,temp); + } } /* filename search pairs for dual file stereo */ diff --git a/src/vgmstream.h b/src/vgmstream.h index 34e10b27..af76bd23 100644 --- a/src/vgmstream.h +++ b/src/vgmstream.h @@ -6,6 +6,7 @@ #define _VGMSTREAM_H enum { PATH_LIMIT = 32768 }; +enum { STREAM_NAME_SIZE = 255 }; /* reasonable max */ #include "streamfile.h" @@ -698,7 +699,11 @@ typedef struct { coding_t coding_type; /* type of encoding */ layout_t layout_type; /* type of layout for data */ meta_t meta_type; /* how we know the metadata */ - int num_streams; /* info only, for a few multi-stream formats (0=not set/one, 1=one stream) */ + + /* streams (info only) */ + int num_streams; /* for multi-stream formats (0=not set/one, 1=one stream) */ + int stream_index; /* current stream */ + char stream_name[STREAM_NAME_SIZE]; /* name of the current stream, if the file stores it and it's filled */ /* looping */ int loop_flag; /* is this stream looped? */