Ray Lopez
2009-01-13 14:56:19 UTC
I am trying to grab the desktop display, scale it and then stream it to
another PC. I know you can do this through the command line interface and I
have done it this way successfully, but would like to write my own custom
implementation. So I proceeded with an example I found, modified it as I
understood things and this is some of what I have?
AVFormatContext *ifc;
AVCodecContext *cc;
AVInputFormat *iformat;
AVCodec *codec;
char* filename;
int i, videoStream = 0;
av_register_all();
iformat = av_find_input_format("x11grab");
if (!iformat)
{
fprintf(stderr, "Unknown input format: X11grab\n");
// return -1;
}
// Open video file
if(av_open_input_file(&ifc, filename, iformat, 0, NULL)!=0)
{
fprintf(stderr, "Couldn't open file\n");
return -1; // Couldn't open file
}
This fails because it is not a known input format. So is the format I
passing to av_find_input_format incorrect or I am not
approaching/understanding this altogether? How do I go about grabbing the
display frame?
Ray
another PC. I know you can do this through the command line interface and I
have done it this way successfully, but would like to write my own custom
implementation. So I proceeded with an example I found, modified it as I
understood things and this is some of what I have?
AVFormatContext *ifc;
AVCodecContext *cc;
AVInputFormat *iformat;
AVCodec *codec;
char* filename;
int i, videoStream = 0;
av_register_all();
iformat = av_find_input_format("x11grab");
if (!iformat)
{
fprintf(stderr, "Unknown input format: X11grab\n");
// return -1;
}
// Open video file
if(av_open_input_file(&ifc, filename, iformat, 0, NULL)!=0)
{
fprintf(stderr, "Couldn't open file\n");
return -1; // Couldn't open file
}
This fails because it is not a known input format. So is the format I
passing to av_find_input_format incorrect or I am not
approaching/understanding this altogether? How do I go about grabbing the
display frame?
Ray