20 May '13 - 23:41 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: Cannot save ASX stream  (Read 360 times)
od
Posts: 2


« on: 8 Dec '11 - 09:19 »
Reply with quoteQuote

edit: Nevermind, after checking out a few threads I see that ASX streams need to use the BASSenc with BASS_WMA_StreamCreateURL.

After using the BASSWMA.DLL, I was able to connect & listen to an ASX stream. But unfortunately, when I try to record it, the DOWNLOADPROC handler doesn't seem to be executing. When I try it with a regular .pls stream the recording function works perfect, so this leads me to believe it's an issue with WMA/ASX streams.

Here's part of the sample code I'm trying to use:

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim CI As New Un4seen.Bass.BASS_CHANNELINFO
        Dim TI As New Un4seen.Bass.AddOn.Tags.TAG_INFO

        Bass.BASS_PluginLoad("basswma.dll")
        Un4seen.Bass.Bass.BASS_SetConfig(Un4seen.Bass.BASSConfig.BASS_CONFIG_NET_PLAYLIST, 1)
        Dim strm As String = "http://127.0.0.1:51710/sirius?channel=100&format=asx"
        Dim stream
        _myDownloadProc = New DOWNLOADPROC(AddressOf MyDownload)
        stream = Bass.BASS_StreamCreateURL(strm, 0, BASSFlag.BASS_DEFAULT, _myDownloadProc, IntPtr.Zero)
        Bass.BASS_ChannelPlay(stream, False)

        Timer1.Enabled = True
    End Sub

    Private Sub MyDownload(ByVal buffer As IntPtr, ByVal length As Integer, ByVal user As IntPtr)

        If _fs Is Nothing Then
            ' create the file
            _fs = File.OpenWrite("output.mp3")
        End If

        ' increase the data buffer as needed
        If _data Is Nothing OrElse _data.Length < length Then
            _data = New Byte(length) {}
        End If
        ' copy from managed to unmanaged memory
        Marshal.Copy(buffer, _data, 0, length)
        ' write to file
        _fs.Write(_data, 0, length)

    End Sub

From my test, the "MyDownload" sub isn't being executed when connected to an ASX stream.

Is there any way I can go about this? Thanks in advance[/s]
« Last Edit: 8 Dec '11 - 11:04 by od » Logged
radio42
Posts: 4012


« Reply #1 on: 8 Dec '11 - 11:41 »
Reply with quoteQuote

As far as I know, does the BASSwma add-on NOT support the DOWNLOADPROC.
Meaning even if specified in the generic 'BASS_StreamCreateURL' call - this param would simply be ignored with a WMA stream.
Logged
od
Posts: 2


« Reply #2 on: 8 Dec '11 - 11:49 »
Reply with quoteQuote

Yup, you're right. I needed to do a bit more researching before making this thread.

Everything is perfect right now, here's the meat of the code for anyone looking for a solution:

        Bass.BASS_PluginLoad("basswma.dll")
        Un4seen.Bass.Bass.BASS_SetConfig(Un4seen.Bass.BASSConfig.BASS_CONFIG_NET_PLAYLIST, 1)
        Dim strm As String = "http://a71.l2280060748.c22800.g.lm.akamaistream.net/D/71/22800/v0001/reflector:60748?aifp=abcd&partner=sirius_online_subscriber&stream=howardstern101&auth=db.aDcRd9cWdnbjbYdmcHbEckcNb3a3dlb6-bo4kjG-8-vga-KtDTsryecao-kjmcn9k9jkt5pTp4kdsVt4nYkerdmctSkXmem7kfjds6oaogkcsjtTn1l5s3n3tRk1m3m4kUk6t3pi&login_type=guest&login=odl7fmf756bew1x60586@binkmail.com&campaign=default&bitrate=high&wmcache=0&mswmext=.asx"
        Dim stream
        stream = BassWma.BASS_WMA_StreamCreateURL(strm, 0, 0, BASSFlag.BASS_DEFAULT)
        Un4seen.Bass.Bass.BASS_ChannelSetAttribute(stream, BASSAttribute.BASS_ATTRIB_VOL, 0)
        Dim intEncodingResult As Integer = Un4seen.Bass.AddOn.Enc.BassEnc.BASS_Encode_Start(stream, """Y:\LAME x64\lame.exe"" --alt-preset standard - c:\output.mp3", AddOn.Enc.BASSEncode.BASS_ENCODE_AUTOFREE, Nothing, 0)
        Bass.BASS_ChannelPlay(stream, False)

Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines