24 May '13 - 12:59 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
  Home Help Search Login Register  
  Show Posts
Pages: [1]
1  Developments / BASS / Re: iOS m4a streamCreateFileUser problems on: 14 Nov '11 - 11:55
Okay, I've tried what you suggested, I started a decoder channel

_decoder = BASS_StreamCreateFileUser(STREAMFILE_NOBUFFER, BASS_STREAM_DECODE, &decoderFileProcs, NULL)

and a playing channel

_channel = BASS_StreamCreate(ci.freq, ci.chans, ci.flags&(BASS_SAMPLE_FLOAT|BASS_SAMPLE_8BITS), STREAMPROC_PUSH, 0)

and then I am feeding the playing channel in a separate thread

 while (1)
    {
        BYTE buf[10000];
        DWORD c = BASS_ChannelGetData(_decoder, buf, sizeof(buf)); // request data from the decoder
        if (c==-1) break; // error, eg. EOF or freed
        c = BASS_StreamPutData(_channel, buf, c); // feed the data to the push stream
        if (c) usleep(100000); // queued data means the playback buffer is full, so wait a bit (100ms)
    }

but it still works just for mp3 files.
If I try mp4 aac files or even lpcm, it just returns BASS_ERROR_FILEFORM.
I thought at least LPCM should work but it doesn't :/

Do you have any other ideas?
I really don't want to ditch BASS for playing filetypes other than mp3...

Also, what I've tried and doesn't work with mp4 files

NSString *fullPath = [[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:fileName];
    NSData *data = [[NSData alloc] initWithContentsOfFile:fullPath];
NSData *subData = [data subdataWithRange:NSMakeRange(0, data.length / 2)];
    if(!(_channel=BASS_StreamCreateFile(TRUE,[subData bytes],0,subData.length,BASS_SAMPLE_LOOP|BASS_SAMPLE_FLOAT)))

but it works perfect when the data provided is whole,


if(!(_channel=BASS_StreamCreateFile(TRUE,[data bytes],0,data.length,BASS_SAMPLE_LOOP|BASS_SAMPLE_FLOAT)))

So basically, it comes to having to provide the whole file data in order to play the mp4 file,
which is not acceptable for my app. Imagine loading a 280 minute podcast here Smiley
ReplyReply Reply with quoteQuote
2  Developments / BASS / Re: iOS m4a streamCreateFileUser problems on: 11 Nov '11 - 11:12
Thank you very much Ian!

I will try this and report back if it is the proper solution for my problem.
ReplyReply Reply with quoteQuote
3  Developments / BASS / Re: iOS m4a streamCreateFileUser problems on: 7 Nov '11 - 18:51
Unfortunately no, the demands for this app are pretty preposterous,
you would be amazed Smiley
Okay then, I will have to think of some workaround for this.

Thanks for the prompt answer!
ReplyReply Reply with quoteQuote
4  Developments / BASS / iOS m4a streamCreateFileUser problems on: 7 Nov '11 - 15:48
Hi Ian, 

First of all, great work with the iOS port, I love using BASS library.
I'm coding an app which plays streams of raw data and am pretty much finished with the code.
Everything works perfectly well with mp3 files, but m4a files just won't budge. What I'm doing is creating a stream of length 0
so that data is read without stopping

BASS_StreamCreateFileUser(STREAMFILE_BUFFER, BASS_STREAM_RESTRATE, &bgFileProcs, NULL)

and then feeding the fileReadProc with raw bytes which I have stored in NSMutableData.
I've seen a previous post where there is a claim that this should work without add ons.
Can you give me a hint to what this problem with playing m4a files could be about?

Thanks in advance!
ReplyReply Reply with quoteQuote
Pages: [1]
Powered by SMF 1.1.18 | SMF © 2013, Simple Machines