On 2/29/08, Luca Abeni <[EMAIL PROTECTED]> wrote:
Hi Luca!
Mahmoud M'HIRI wrote:
> > The problem here is that I'm not dealing with a streaming server with
> an
> > SDP negociation.
>
> Then, your server looks broken. Anyway, you can forge an SDP by yourself.
>
>
> > I have to listen to UDP packets, extract RTP packets, and
> > retrieve the payload.
>
> Why do you want to parse RTP packets by yourself if libavformat can
> already do it?
well, it's not my may to spend my free time but because didn't knew about
that!
I spent the weekend in printing and reading all the code related to inputs
and networking in ffmpeg (udp.c, rtp.c, rtp.h, avio.c, avio.h,....), here
what I figured out: ffmpeg implements methods of reading streams from file,
http, rtp, udp, ... and for each protocols fills this a struct of
URLProtocol type, here the example for http:
URLProtocol http_protocol = {
"http",
http_open,
http_read,
http_write,
http_seek,
http_close,
};
and for use in a user program, the developer have only to use the high level
functions: url_read, url_open,.. which detects the protocol and makes the
mapping for the correct input method through this line:
ret = h->prot->url_read(h, buf, size);
But the problem is in those few lines:
int main ( int argc, char *argv[] )
{
// Initialization
av_register_all();
URLContext *h;
const char *filename = "udp://0.0.0.0:8060/";
int flags = 0;
unsigned char buffer[1024];
int size = 3;
if ((url_open(&h, filename, flags)) < 0){
cout << "ERROR\n";
return -1;
}
else
cout << "Stream opened!" << endl;
if (url_read(h, buffer, size)<0){
cout << "ERROR\n";
return -1;
}
cout << "Stram read!" << endl;
}
The output is only:
Stream opened!
Despite I'm sniffing RTP/UDP packets on my 8060 port.
Any hints??
Thanks again.
> That's done, but I'm missing the code that mke me able
> > to join payloads to build frames and then decode them.
>
> To do this, you have to look at the RTP headers, and at the payload
> headers. All the information are in the relevant RFCs. But, again,
> libavformat already provides code for parsing such headers.
>
>
>
> Luca
>
> _______________________________________________
> libav-user mailing list
> [email protected]
> https://lists.mplayerhq.hu/mailman/listinfo/libav-user
>
--
Mahmoud M'HIRI
[EMAIL PROTECTED]
Phone: Under request
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user