I have created one program to download MMS stream via lib mms and load it
via FFMPEG. For some reason it fails at av_open_input_stream
Here is my code
#include <stdio.h>
#include "libmms/mmsx.h"
#include "libmms/mms.h"
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
const char *url = "mms://live.cumulusstreaming.com/KPLX-FM";
int main(int argc, char *argv[])
{
mmsx_t *this = NULL;
char buf[2048];
int i, res;
FILE* f;
AVFormatContext* pFormatCtx;
av_register_all();
AVInputFormat* asf = av_find_input_format("asf");
av_register_input_format(asf);
if((this = mmsx_connect(NULL, NULL, url, 1)))
printf("Connect OK\n");
read_data(this, buf, 2048);
AVProbeData pd;
pd.buf = buf;
pd.buf_size = 2048;
pd.filename = "";
AVInputFormat* pAVInputFormat = av_probe_input_format(&pd, 1);
if(!pAVInputFormat)
{
printf("Probe not successful\n");
}
else
{
printf("Probe successfull------%s-------%s\n",pAVInputFormat->name,
pAVInputFormat->long_name);
}
pAVInputFormat->flags |= AVFMT_NOFILE;
ByteIOContext ByteIOCtx;
if(init_put_byte(&ByteIOCtx, buf, 2048, 0, this, read_data, NULL, NULL) <
0)
{
printf("init_put_byte not successful\n");
}
else
{
printf("init_put_byte successful\n");
}
if(av_open_input_stream(&pFormatCtx, &ByteIOCtx, "", pAVInputFormat,NULL)
< 0)
{
printf("Open input stream not successful\n");
}
}
int read_data(void *opaque, char *buf, int buf_size)
{
printf("Read DATA\n");
mmsx_t *this = (mmsx_t *)opaque;
int cnt = mmsx_read(NULL, this, buf, 1024);
return cnt;
}
It works perfectly till init_put_byte, i am getting below output
Connect OK
Read DATA
Probe successfull------asf-------ASF format
init_put_byte successful
Read DATA
Open input stream not successful
I am not sure what is wrong here, probably I am supposed to use different
code/method for ASF ? Is there any way I can get more information debug
information on how it is failing?
Thank You
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user