Ejemplo n.º 1
0
        /// <summary>
        /// Retrieves tags/headers from a channel.
        /// </summary>
        /// <param name="handle">The channel handle... a HMUSIC or HSTREAM.</param>
        /// <param name="tags">The tags/headers wanted... one of the following
        /// BASS_TAG_AM_MIME Android media codec MIME type. A single string is returned.
        /// BASS_TAG_AM_NAME Android media codec name.A single string is returned.This in only available on Android 4.3 and above.
        /// BASS_TAG_APE APE (v1 or v2) tags.A pointer to a series of null-terminated UTF-8 strings is returned, the final string ending with a double null. Each string is in the form of "key=value", or "key=value1/value2/..." if there are multiple values.
        /// BASS_TAG_APE_BINARY APE binary tag.A pointer to a TAG_APE_BINARY structure is returned.
        /// + tag number (0=first)
        /// BASS_TAG_CA_CODEC CoreAudio codec information.A pointer to a TAG_CA_CODEC structure is returned.
        /// BASS_TAG_HTTP HTTP headers, only available when streaming from a HTTP server. A pointer to a series of null-terminated strings is returned, the final string ending with a double null.
        /// BASS_TAG_ICY ICY (Shoutcast) tags. A pointer to a series of null-terminated strings is returned, the final string ending with a double null.
        /// BASS_TAG_ID3 ID3v1 tags.A pointer to a TAG_ID3 structure is returned.
        /// BASS_TAG_ID3V2 ID3v2 tags.A pointer to a variable length block is returned.ID3v2 tags are supported at both the start and end of the file, and in designated RIFF/AIFF chunks. See www.id3.org for details of the block's structure.
        /// BASS_TAG_LYRICS3 Lyrics3v2 tag.A single string is returned, containing the Lyrics3v2 information. See www.id3.org/Lyrics3v2 for details of its format.
        /// BASS_TAG_META Shoutcast metadata.A single string is returned, containing the current stream title and url (usually omitted). The format of the string is: StreamTitle= 'xxx'; StreamUrl='xxx';
        /// BASS_TAG_MF Media Foundation metadata.A pointer to a series of null-terminated UTF-8 strings is returned, the final string ending with a double null.
        /// BASS_TAG_MP4 MP4/iTunes metadata. A pointer to a series of null-terminated UTF-8 strings is returned, the final string ending with a double null.
        /// BASS_TAG_MUSIC_AUTH MOD music author. Only available in files created with the OpenMPT tracker.
        /// BASS_TAG_MUSIC_INST MOD instrument name.Only available with formats that have instruments, eg.IT and XM(and MO3).
        /// + instrument number (0=first)
        /// BASS_TAG_MUSIC_MESSAGE MOD message text.
        /// BASS_TAG_MUSIC_NAME MOD music title.
        /// BASS_TAG_MUSIC_ORDERS MOD music order list.A pointer to a byte array is returned, with each byte being the pattern number played at that order position. Pattern number 254 is "+++" (skip order) and 255 is "---" (end song).
        /// BASS_TAG_MUSIC_SAMPLE MOD sample name.
        /// + sample number (0=first)
        /// BASS_TAG_OGG OGG comments.A pointer to a series of null-terminated UTF-8 strings is returned, the final string ending with a double null.
        /// BASS_TAG_RIFF_BEXT RIFF/BWF "bext" chunk tags.A pointer to a TAG_BEXT structure is returned.
        /// BASS_TAG_RIFF_CART RIFF/BWF "cart" chunk tags. A pointer to a TAG_CART structure is returned.
        /// BASS_TAG_RIFF_CUE RIFF "cue " chunk.A pointer to a TAG_CUE structure is returned.
        /// BASS_TAG_RIFF_DISP RIFF "DISP" chunk text (CF_TEXT) tag. A single string is returned.
        /// BASS_TAG_RIFF_INFO RIFF "INFO" chunk tags. A pointer to a series of null-terminated strings is returned, the final string ending with a double null. The tags are in the form of "XXXX=text", where "XXXX" is the chunk ID.
        /// BASS_TAG_RIFF_SMPL RIFF "smpl" chunk.A pointer to a TAG_SMPL structure is returned.
        /// BASS_TAG_VENDOR OGG encoder.A single UTF-8 string is returned.
        /// BASS_TAG_WAVEFORMAT WAVE "fmt " chunk contents. A pointer to a WAVEFORMATEX structure is returned.As well as WAVE files, this is also provided by Media Foundation codecs.
        /// BASS_TAG_WMA WMA tags.A pointer to a series of null-terminated UTF-8 strings is returned, the final string ending with a double null.
        /// other tags may be supported by add-ons, see the documentation
        /// </param>
        /// <returns>If successful, the requested tags are returned, else NULL is returned. Use BASS_ErrorGetCode to get the error code</returns>
        public static IntPtr BASS_ChannelGetTags(int handle, BASSTag tags)
        {
            IntPtr result = NativeMethods.BASS_ChannelGetTags(handle, tags);

            if (result == IntPtr.Zero)
            {
                throw new WavException(BassErrorCode.GetErrorInfo());
            }

            return(result);
        }
Ejemplo n.º 2
0
 public Bass_TagReadOnly(string FileName)
 {
     _bitrate               = BassTags.BASS_TAG_GetFromFile(FileName).bitrate;
     _channelinfo           = BassTags.BASS_TAG_GetFromFile(FileName).channelinfo;
     _copyright             = BassTags.BASS_TAG_GetFromFile(FileName).copyright;
     _duration              = BassTags.BASS_TAG_GetFromFile(FileName).duration;
     _encodedby             = BassTags.BASS_TAG_GetFromFile(FileName).encodedby;
     _filename              = BassTags.BASS_TAG_GetFromFile(FileName).filename;
     _grouping              = BassTags.BASS_TAG_GetFromFile(FileName).grouping;
     _isrc                  = BassTags.BASS_TAG_GetFromFile(FileName).isrc;
     _mood                  = BassTags.BASS_TAG_GetFromFile(FileName).mood;
     _replaygain_track_gain = BassTags.BASS_TAG_GetFromFile(FileName).replaygain_track_gain;
     _replaygain_track_peak = BassTags.BASS_TAG_GetFromFile(FileName).replaygain_track_peak;
     _tagType               = BassTags.BASS_TAG_GetFromFile(FileName).tagType;
 }
Ejemplo n.º 3
0
 public static string[] BASS_ChannelGetTagsArrayNullTermUtf8(int handle, BASSTag format)
 {
     return Utils.IntPtrToArrayNullTermUtf8(BASS_ChannelGetTags(handle, format));
 }
Ejemplo n.º 4
0
 public static extern IntPtr BASS_ChannelGetTags(int handle, BASSTag tags);
Ejemplo n.º 5
0
        public void LoadFile(string file)
        {
            ChannelType = CHANNEL_TYPE.STREAM;

            this.Stop();

            int stream = Bass.BASS_StreamCreateFile(file, 0, 0, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE);

            if (stream == Bass.FALSE)
            {
                stream = Bass.BASS_MusicLoad(file, 0L, 0, BASSFlag.BASS_MUSIC_DECODE | BASSFlag.BASS_MUSIC_FLOAT | BASSFlag.BASS_MUSIC_PRESCAN | BASSFlag.BASS_MUSIC_POSRESETEX | BASSFlag.BASS_MUSIC_RAMP, 0);

                if (stream != Bass.FALSE)
                {
                    ChannelType = CHANNEL_TYPE.MUSIC;
                }
            }

            if (stream == Bass.FALSE)
            {
                stream = Bass.BASS_StreamCreateURL(file, 0, BASSFlag.BASS_SAMPLE_FLOAT | BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_STREAM_STATUS, downloadProc, IntPtr.Zero);
                if (stream != Bass.FALSE)
                {
                    ChannelType = CHANNEL_TYPE.REMOTE_URL;
                }
            }

            TAG_INFO         tagInfo     = new TAG_INFO(file);
            BASS_CHANNELINFO channelInfo = stream != Bass.FALSE ?
                                           Bass.BASS_ChannelGetInfo(stream) :
                                           new BASS_CHANNELINFO();

            this.Stream = stream;

            if (stream != Bass.FALSE)
            {
                bool isTagAvailable = ChannelType == CHANNEL_TYPE.REMOTE_URL ? BassTags.BASS_TAG_GetFromURL(stream, tagInfo) : BassTags.BASS_TAG_GetFromFile(stream, tagInfo);

                this.LengthInBytes   = Bass.BASS_ChannelGetLength(stream);
                this.LengthInSeconds = Bass.BASS_ChannelBytes2Seconds(stream, this.LengthInBytes);
            }

            this.TagInfo = tagInfo;

            this.ChannelInfo = channelInfo;

            if (ChannelType == CHANNEL_TYPE.REMOTE_URL)
            {
                BASSTag tagType = TagInfo.tagType;

                BASSSync syncFlag = syncFlag = BASSSync.BASS_SYNC_META;

                if (tagType == BASSTag.BASS_TAG_WMA)
                {
                    syncFlag = BASSSync.BASS_SYNC_WMA_META;
                }

                bool isWMA = false;

                if (channelInfo.ctype == BASSChannelType.BASS_CTYPE_STREAM_WMA)
                {
                    isWMA = true;
                }
                // ok, do some pre-buffering...
                System.Diagnostics.Debug.WriteLine("Buffering...");
                if (!isWMA)
                {
                    // display buffering for MP3, OGG...
                    while (true)
                    {
                        long len = Bass.BASS_StreamGetFilePosition(stream, BASSStreamFilePosition.BASS_FILEPOS_END);
                        if (len == -1)
                        {
                            break; // typical for WMA streams
                        }
                        // percentage of buffer filled
                        float progress = (
                            Bass.BASS_StreamGetFilePosition(stream, BASSStreamFilePosition.BASS_FILEPOS_DOWNLOAD) -
                            Bass.BASS_StreamGetFilePosition(stream, BASSStreamFilePosition.BASS_FILEPOS_CURRENT)
                            ) * 100f / len;

                        if (progress > 75f)
                        {
                            break; // over 75% full, enough
                        }

                        System.Diagnostics.Debug.WriteLine(String.Format("Buffering... {0}%", progress));
                    }
                }
                else
                {
                    // display buffering for WMA...
                    while (true)
                    {
                        long len = Bass.BASS_StreamGetFilePosition(stream, BASSStreamFilePosition.BASS_FILEPOS_WMA_BUFFER);
                        if (len == -1L)
                        {
                            break;
                        }
                        // percentage of buffer filled
                        if (len > 75L)
                        {
                            break; // over 75% full, enough
                        }

                        System.Diagnostics.Debug.WriteLine(String.Format("Buffering... {0}%", len));
                    }
                }

                // get the meta tags (manually - will not work for WMA streams here)
                string[] icy = Bass.BASS_ChannelGetTagsICY(stream);
                if (icy == null)
                {
                    // try http...
                    icy = Bass.BASS_ChannelGetTagsHTTP(stream);
                }
                if (icy != null)
                {
                    foreach (string tag in icy)
                    {
                        System.Diagnostics.Debug.WriteLine("ICY: " + tag);
                    }
                }
                // get the initial meta data (streamed title...)
                icy = Bass.BASS_ChannelGetTagsMETA(stream);
                if (icy != null)
                {
                    foreach (string tag in icy)
                    {
                        System.Diagnostics.Debug.WriteLine("Meta: " + tag);
                    }
                }
                else
                {
                    // an ogg stream meta can be obtained here
                    icy = Bass.BASS_ChannelGetTagsOGG(stream);
                    if (icy != null)
                    {
                        foreach (string tag in icy)
                        {
                            System.Diagnostics.Debug.WriteLine("Meta: " + tag);
                        }
                    }
                }

                syncMetaUpdated = new SYNCPROC(SyncMetaCallback);

                mySyncHandleMetaUpdate = Bass.BASS_ChannelSetSync(stream, syncFlag, 0, syncMetaUpdated, IntPtr.Zero);
            }

            OnStreamCreated(stream);
        }
Ejemplo n.º 6
0
        public static bool BASS_TAG_GetFromFile(int stream, TAG_INFO tags)
        {
            if ((stream == 0) || (tags == null))
            {
                return(false);
            }
            bool             flag             = false;
            BASS_CHANNELINFO bass_channelinfo = new BASS_CHANNELINFO();

            if (!Un4seen.Bass.Bass.BASS_ChannelGetInfo(stream, bass_channelinfo))
            {
                return(flag);
            }
            tags.channelinfo = bass_channelinfo;
            BASSTag tagType = BASSTag.BASS_TAG_UNKNOWN;
            IntPtr  p       = BASS_TAG_GetIntPtr(stream, bass_channelinfo, out tagType);

            if (p != IntPtr.Zero)
            {
                switch (tagType)
                {
                case BASSTag.BASS_TAG_MUSIC_NAME:
                    tags.title  = Un4seen.Bass.Bass.BASS_ChannelGetMusicName(stream);
                    tags.artist = Un4seen.Bass.Bass.BASS_ChannelGetMusicMessage(stream);
                    flag        = true;
                    goto Label_0229;

                case BASSTag.BASS_TAG_MIDI_TRACK:
                {
                    int num = 0;
                    while (true)
                    {
                        IntPtr data = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, (BASSTag)(0x11000 + num));
                        if (!(data != IntPtr.Zero))
                        {
                            if (!flag && (tags.NativeTags.Length > 0))
                            {
                                flag = true;
                                if (tags.NativeTags.Length > 0)
                                {
                                    tags.title = tags.NativeTags[0].Trim();
                                }
                                if (tags.NativeTags.Length > 1)
                                {
                                    tags.artist = tags.NativeTags[1].Trim();
                                }
                            }
                            goto Label_0229;
                        }
                        flag |= tags.UpdateFromMETA(data, false);
                        num++;
                    }
                }

                case BASSTag.BASS_TAG_ID3:
                    flag = ReadID3v1(p, tags);
                    goto Label_0229;

                case BASSTag.BASS_TAG_ID3V2:
                    flag = ReadID3v2(p, tags);
                    goto Label_0229;

                case BASSTag.BASS_TAG_OGG:
                    flag = tags.UpdateFromMETA(p, true);
                    goto Label_0229;

                case BASSTag.BASS_TAG_HTTP:
                case BASSTag.BASS_TAG_ICY:
                case BASSTag.BASS_TAG_META:
                    goto Label_0229;

                case BASSTag.BASS_TAG_APE:
                    flag = tags.UpdateFromMETA(p, true);
                    goto Label_0229;

                case BASSTag.BASS_TAG_MP4:
                    flag = tags.UpdateFromMETA(p, true);
                    goto Label_0229;

                case BASSTag.BASS_TAG_RIFF_INFO:
                    flag = tags.UpdateFromMETA(p, false);
                    goto Label_0229;
                }
            }
Label_0229:
            tags.duration = Un4seen.Bass.Bass.BASS_ChannelBytes2Seconds(stream, Un4seen.Bass.Bass.BASS_ChannelGetLength(stream));
            if (tags.bitrate == 0)
            {
                long num2 = Un4seen.Bass.Bass.BASS_StreamGetFilePosition(stream, BASSStreamFilePosition.BASS_FILEPOS_END);
                tags.bitrate = (int)((((double)num2) / (125.0 * tags.duration)) + 0.5);
            }
            return(flag);
        }
Ejemplo n.º 7
0
        private static IntPtr BASS_TAG_GetIntPtr(int stream, BASS_CHANNELINFO info, out BASSTag tagType)
        {
            IntPtr zero = IntPtr.Zero;

            tagType = BASSTag.BASS_TAG_UNKNOWN;
            if ((stream == 0) || (info == null))
            {
                return(zero);
            }
            BASSChannelType ctype = info.ctype;

            if ((ctype & BASSChannelType.BASS_CTYPE_STREAM_WAV) > BASSChannelType.BASS_CTYPE_UNKNOWN)
            {
                ctype = BASSChannelType.BASS_CTYPE_STREAM_WAV;
            }
            switch (ctype)
            {
            case BASSChannelType.BASS_CTYPE_STREAM_WMA:
            case BASSChannelType.BASS_CTYPE_STREAM_WMA_MP3:
                zero    = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_WMA);
                tagType = BASSTag.BASS_TAG_WMA;
                return(zero);

            case BASSChannelType.BASS_CTYPE_STREAM_WINAMP:
                zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_ID3V2);
                if (!(zero == IntPtr.Zero))
                {
                    tagType = BASSTag.BASS_TAG_ID3V2;
                    return(zero);
                }
                zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_APE);
                if (!(zero == IntPtr.Zero))
                {
                    tagType = BASSTag.BASS_TAG_APE;
                    return(zero);
                }
                zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_OGG);
                if (zero == IntPtr.Zero)
                {
                    zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_ID3);
                    if (zero != IntPtr.Zero)
                    {
                        tagType = BASSTag.BASS_TAG_ID3;
                    }
                    return(zero);
                }
                tagType = BASSTag.BASS_TAG_OGG;
                return(zero);

            case BASSChannelType.BASS_CTYPE_STREAM_OGG:
                zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_OGG);
                if (!(zero == IntPtr.Zero))
                {
                    tagType = BASSTag.BASS_TAG_OGG;
                    return(zero);
                }
                zero    = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_APE);
                tagType = BASSTag.BASS_TAG_APE;
                return(zero);

            case BASSChannelType.BASS_CTYPE_STREAM_MP1:
            case BASSChannelType.BASS_CTYPE_STREAM_MP2:
            case BASSChannelType.BASS_CTYPE_STREAM_MP3:
                zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_ID3V2);
                if (!(zero == IntPtr.Zero))
                {
                    tagType = BASSTag.BASS_TAG_ID3V2;
                    return(zero);
                }
                zero    = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_ID3);
                tagType = BASSTag.BASS_TAG_ID3;
                return(zero);

            case BASSChannelType.BASS_CTYPE_STREAM_AIFF:
            case BASSChannelType.BASS_CTYPE_STREAM_WAV:
            case BASSChannelType.BASS_CTYPE_STREAM_WAV_PCM:
            case BASSChannelType.BASS_CTYPE_STREAM_WAV_FLOAT:
                zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_RIFF_INFO);
                if (zero != IntPtr.Zero)
                {
                    tagType = BASSTag.BASS_TAG_RIFF_INFO;
                }
                return(zero);

            case BASSChannelType.BASS_CTYPE_MUSIC_MO3:
            case BASSChannelType.BASS_CTYPE_MUSIC_MOD:
            case BASSChannelType.BASS_CTYPE_MUSIC_MTM:
            case BASSChannelType.BASS_CTYPE_MUSIC_S3M:
            case BASSChannelType.BASS_CTYPE_MUSIC_XM:
            case BASSChannelType.BASS_CTYPE_MUSIC_IT:
                zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_MUSIC_NAME);
                if (zero != IntPtr.Zero)
                {
                    tagType = BASSTag.BASS_TAG_MUSIC_NAME;
                }
                return(zero);

            case BASSChannelType.BASS_CTYPE_STREAM_WV:
            case BASSChannelType.BASS_CTYPE_STREAM_WV_H:
            case BASSChannelType.BASS_CTYPE_STREAM_WV_L:
            case BASSChannelType.BASS_CTYPE_STREAM_WV_LH:
            case BASSChannelType.BASS_CTYPE_STREAM_OFR:
            case BASSChannelType.BASS_CTYPE_STREAM_APE:
            case BASSChannelType.BASS_CTYPE_STREAM_FLAC:
            case BASSChannelType.BASS_CTYPE_STREAM_SPX:
            case BASSChannelType.BASS_CTYPE_STREAM_MPC:
            case BASSChannelType.BASS_CTYPE_STREAM_TTA:
                zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_APE);
                if (zero == IntPtr.Zero)
                {
                    zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_OGG);
                    if (zero == IntPtr.Zero)
                    {
                        zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_ID3V2);
                        if (zero == IntPtr.Zero)
                        {
                            zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_ID3);
                            if (zero != IntPtr.Zero)
                            {
                                tagType = BASSTag.BASS_TAG_ID3;
                            }
                            return(zero);
                        }
                        tagType = BASSTag.BASS_TAG_ID3V2;
                        return(zero);
                    }
                    tagType = BASSTag.BASS_TAG_OGG;
                    return(zero);
                }
                tagType = BASSTag.BASS_TAG_APE;
                return(zero);

            case BASSChannelType.BASS_CTYPE_STREAM_MIDI:
                zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_MIDI_TRACK);
                if (zero == IntPtr.Zero)
                {
                    zero    = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_RIFF_INFO);
                    tagType = BASSTag.BASS_TAG_RIFF_INFO;
                    return(zero);
                }
                tagType = BASSTag.BASS_TAG_MIDI_TRACK;
                return(zero);

            case BASSChannelType.BASS_CTYPE_STREAM_AAC:
            case BASSChannelType.BASS_CTYPE_STREAM_MP4:
            case BASSChannelType.BASS_CTYPE_STREAM_ALAC:
                zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_MP4);
                if (zero == IntPtr.Zero)
                {
                    zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_ID3V2);
                    if (zero == IntPtr.Zero)
                    {
                        zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_APE);
                        if (zero == IntPtr.Zero)
                        {
                            zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_OGG);
                            if (zero != IntPtr.Zero)
                            {
                                tagType = BASSTag.BASS_TAG_OGG;
                            }
                            return(zero);
                        }
                        tagType = BASSTag.BASS_TAG_APE;
                        return(zero);
                    }
                    tagType = BASSTag.BASS_TAG_ID3V2;
                    return(zero);
                }
                tagType = BASSTag.BASS_TAG_MP4;
                return(zero);
            }
            return(IntPtr.Zero);
        }
Ejemplo n.º 8
0
        public static bool BASS_TAG_GetFromFile(int stream, TAG_INFO tags)
        {
            if ((stream == 0) || (tags == null))
            {
                return(false);
            }
            bool flag = false;

            tags.channelInfo = new BASS_CHANNELINFO();
            if (BASS_ChannelGetInfo(stream, tags.channelInfo))
            {
                BASSTag tagType = BASSTag.BASS_TAG_UNKNOWN;
                IntPtr  p       = BASS_TAG_GetIntPtr(stream, tags.channelInfo, out tagType);
                if (p != IntPtr.Zero)
                {
                    switch (tagType)
                    {
                    case BASSTag.BASS_TAG_ID3:
                        return(ReadID3v1(p, tags));

                    case BASSTag.BASS_TAG_ID3V2:
                        return(ReadID3v2(p, tags));

                    case BASSTag.BASS_TAG_OGG:
                        return(tags.UpdateFromMETA(p.ToInt32(), true));

                    case BASSTag.BASS_TAG_HTTP:
                    case BASSTag.BASS_TAG_ICY:
                    case BASSTag.BASS_TAG_META:
                        return(flag);

                    case BASSTag.BASS_TAG_APE:
                        return(tags.UpdateFromMETA(p.ToInt32(), false));

                    case BASSTag.BASS_TAG_MP4:
                        return(tags.UpdateFromMETA(p.ToInt32(), false));

                    case BASSTag.BASS_TAG_WMA:
                        flag = tags.UpdateFromMETA(p.ToInt32(), true);
                        try
                        {
                            IntPtr pUnk = BASS_WMA_GetWMObject(stream);
                            if (!(pUnk != IntPtr.Zero))
                            {
                                return(flag);
                            }
                            IWMHeaderInfo3 objectForIUnknown = (IWMHeaderInfo3)Marshal.GetObjectForIUnknown(pUnk);
                            ArrayList      allPictures       = new WMFMetadataEditor(objectForIUnknown).GetAllPictures();
                            if (allPictures != null)
                            {
                                foreach (TagPicture picture in allPictures)
                                {
                                    tags.AddPicture(picture);
                                }
                            }
                            objectForIUnknown = null;
                            GC.Collect();
                        }
                        catch
                        {
                        }
                        return(flag);

                    case BASSTag.BASS_TAG_RIFF_INFO:
                        return(tags.UpdateFromMETA(p.ToInt32(), false));

                    case BASSTag.BASS_TAG_MUSIC_NAME:
                        tags.title  = BASS_ChannelGetMusicName(stream);
                        tags.artist = BASS_ChannelGetMusicMessage(stream);
                        return(true);
                    }
                }
            }
            return(flag);
        }
Ejemplo n.º 9
0
 private static extern IntPtr BASS_ChannelGetTags(int handle, BASSTag tags);
Ejemplo n.º 10
0
        private static IntPtr BASS_TAG_GetIntPtr(int stream, BASS_CHANNELINFO info, out BASSTag tagType)
        {
            IntPtr zero = IntPtr.Zero;
            tagType = BASSTag.BASS_TAG_UNKNOWN;
            if ((stream == 0) || (info == null))
            {
                return zero;
            }
            BASSChannelType ctype = info.ctype;
            if ((ctype & BASSChannelType.BASS_CTYPE_STREAM_WAV) > BASSChannelType.BASS_CTYPE_UNKNOWN)
            {
                ctype = BASSChannelType.BASS_CTYPE_STREAM_WAV;
            }
            switch (ctype)
            {
                case BASSChannelType.BASS_CTYPE_STREAM_WMA:
                case BASSChannelType.BASS_CTYPE_STREAM_WMA_MP3:
                    zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_WMA);
                    tagType = BASSTag.BASS_TAG_WMA;
                    return zero;

                case BASSChannelType.BASS_CTYPE_STREAM_WINAMP:
                    zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_ID3V2);
                    if (!(zero == IntPtr.Zero))
                    {
                        tagType = BASSTag.BASS_TAG_ID3V2;
                        return zero;
                    }
                    zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_APE);
                    if (!(zero == IntPtr.Zero))
                    {
                        tagType = BASSTag.BASS_TAG_APE;
                        return zero;
                    }
                    zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_OGG);
                    if (zero == IntPtr.Zero)
                    {
                        zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_ID3);
                        if (zero != IntPtr.Zero)
                        {
                            tagType = BASSTag.BASS_TAG_ID3;
                        }
                        return zero;
                    }
                    tagType = BASSTag.BASS_TAG_OGG;
                    return zero;

                case BASSChannelType.BASS_CTYPE_STREAM_OGG:
                    zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_OGG);
                    if (!(zero == IntPtr.Zero))
                    {
                        tagType = BASSTag.BASS_TAG_OGG;
                        return zero;
                    }
                    zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_APE);
                    tagType = BASSTag.BASS_TAG_APE;
                    return zero;

                case BASSChannelType.BASS_CTYPE_STREAM_MP1:
                case BASSChannelType.BASS_CTYPE_STREAM_MP2:
                case BASSChannelType.BASS_CTYPE_STREAM_MP3:
                    zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_ID3V2);
                    if (!(zero == IntPtr.Zero))
                    {
                        tagType = BASSTag.BASS_TAG_ID3V2;
                        return zero;
                    }
                    zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_ID3);
                    tagType = BASSTag.BASS_TAG_ID3;
                    return zero;

                case BASSChannelType.BASS_CTYPE_STREAM_AIFF:
                case BASSChannelType.BASS_CTYPE_STREAM_WAV:
                case BASSChannelType.BASS_CTYPE_STREAM_WAV_PCM:
                case BASSChannelType.BASS_CTYPE_STREAM_WAV_FLOAT:
                    zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_RIFF_INFO);
                    if (zero != IntPtr.Zero)
                    {
                        tagType = BASSTag.BASS_TAG_RIFF_INFO;
                    }
                    return zero;

                case BASSChannelType.BASS_CTYPE_MUSIC_MO3:
                case BASSChannelType.BASS_CTYPE_MUSIC_MOD:
                case BASSChannelType.BASS_CTYPE_MUSIC_MTM:
                case BASSChannelType.BASS_CTYPE_MUSIC_S3M:
                case BASSChannelType.BASS_CTYPE_MUSIC_XM:
                case BASSChannelType.BASS_CTYPE_MUSIC_IT:
                    zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_MUSIC_NAME);
                    if (zero != IntPtr.Zero)
                    {
                        tagType = BASSTag.BASS_TAG_MUSIC_NAME;
                    }
                    return zero;

                case BASSChannelType.BASS_CTYPE_STREAM_WV:
                case BASSChannelType.BASS_CTYPE_STREAM_WV_H:
                case BASSChannelType.BASS_CTYPE_STREAM_WV_L:
                case BASSChannelType.BASS_CTYPE_STREAM_WV_LH:
                case BASSChannelType.BASS_CTYPE_STREAM_OFR:
                case BASSChannelType.BASS_CTYPE_STREAM_APE:
                case BASSChannelType.BASS_CTYPE_STREAM_FLAC:
                case BASSChannelType.BASS_CTYPE_STREAM_SPX:
                case BASSChannelType.BASS_CTYPE_STREAM_MPC:
                case BASSChannelType.BASS_CTYPE_STREAM_TTA:
                    zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_APE);
                    if (zero == IntPtr.Zero)
                    {
                        zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_OGG);
                        if (zero == IntPtr.Zero)
                        {
                            zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_ID3V2);
                            if (zero == IntPtr.Zero)
                            {
                                zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_ID3);
                                if (zero != IntPtr.Zero)
                                {
                                    tagType = BASSTag.BASS_TAG_ID3;
                                }
                                return zero;
                            }
                            tagType = BASSTag.BASS_TAG_ID3V2;
                            return zero;
                        }
                        tagType = BASSTag.BASS_TAG_OGG;
                        return zero;
                    }
                    tagType = BASSTag.BASS_TAG_APE;
                    return zero;

                case BASSChannelType.BASS_CTYPE_STREAM_MIDI:
                    zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_MIDI_TRACK);
                    if (zero == IntPtr.Zero)
                    {
                        zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_RIFF_INFO);
                        tagType = BASSTag.BASS_TAG_RIFF_INFO;
                        return zero;
                    }
                    tagType = BASSTag.BASS_TAG_MIDI_TRACK;
                    return zero;

                case BASSChannelType.BASS_CTYPE_STREAM_AAC:
                case BASSChannelType.BASS_CTYPE_STREAM_MP4:
                case BASSChannelType.BASS_CTYPE_STREAM_ALAC:
                    zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_MP4);
                    if (zero == IntPtr.Zero)
                    {
                        zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_ID3V2);
                        if (zero == IntPtr.Zero)
                        {
                            zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_APE);
                            if (zero == IntPtr.Zero)
                            {
                                zero = Un4seen.Bass.Bass.BASS_ChannelGetTags(stream, BASSTag.BASS_TAG_OGG);
                                if (zero != IntPtr.Zero)
                                {
                                    tagType = BASSTag.BASS_TAG_OGG;
                                }
                                return zero;
                            }
                            tagType = BASSTag.BASS_TAG_APE;
                            return zero;
                        }
                        tagType = BASSTag.BASS_TAG_ID3V2;
                        return zero;
                    }
                    tagType = BASSTag.BASS_TAG_MP4;
                    return zero;
            }
            return IntPtr.Zero;
        }
Ejemplo n.º 11
0
 public static string[] BASS_ChannelGetTagsArrayNullTermUtf8(int handle, BASSTag format)
 {
     return(Utils.IntPtrToArrayNullTermUtf8(BASS_ChannelGetTags(handle, format)));
 }