Icecast Streaming Media Server Forum Index Icecast Streaming Media Server
Icecast is a Xiph Foundation Project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

catching audio frames

 
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server
View previous topic :: View next topic  
Author Message
pph



Joined: 17 May 2014
Posts: 3

PostPosted: Sat May 17, 2014 10:10 pm    Post subject: catching audio frames Reply with quote

Hello everyone!

First of all, thank's for the amazing program!

I need to read the sound data thats going through Icecast frame by frame. Kind of like when you open a WAV file with libsndfile and loop through it's frames one by one and read bytes.

I'm thinking about jumping into the source.c file somewhere near the
Code:
            /* save stream to file */
            if (source->dumpfile && source->format->write_buf_to_file)
                source->format->write_buf_to_file (source, refbuf);

part and adding my own function there so it takes each refbuf (refbuf represents a frame right?) as an argument and saves it somewhere temporarily.

My question is, can I rely on the refbuf value? Is it decoded raw data? It's just I'm seeing
Code:
plugin->write_buf_to_file = write_mp3_to_file;

in format_mp3.c, that makes me think the refbuf is some sort of raw data being passed to a corresponding encoder, such as mp3 in this case. Though I believe if the server receives the stream in MP3 already that'd mean reencoding, and it doesn't make much sense then.

Please clarify, I'd really appreciate that
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Sun May 18, 2014 10:49 am    Post subject: Reply with quote

If you are dealing with the main release then each refbuf is just a block of data aligned as how the input module arranges it. In the case of ogg it's on page boundaries but for non-ogg the alignment is not set so you cannot assume it's on frame markers. In the KH tree you can, as I use that assumption to help with the FLV wrapping.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pph



Joined: 17 May 2014
Posts: 3

PostPosted: Tue May 20, 2014 1:54 pm    Post subject: Reply with quote

Thank you for your reply!

I guess the KH refbufs are still encoded into the corresponding format that's being sent from the source? If so, it seems I can't just take a refbuf and decode it into raw audio data, I'll have to take care of the frame boundaries etc. right?

Please help me understand
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Tue May 20, 2014 4:31 pm    Post subject: Reply with quote

In the KH tree, each refbuf on the queue is made up of 1 or more frames (depending on the block size and the size of the mp3/aac frame). There is no decode to PCM going on, just frame alignment. For the main release the frame boundary is not checked for, data in to data out with icy metadata filtered out, aligned on fixed size blocks.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
subRebel style by ktauber