On Mon, Jul 26, 2010 at 3:54 PM, Tomas Härdin <[email protected]>wrote:
> On Thu, 2010-07-22 at 23:40 +0900, Nhat Huy wrote: > > On Thu, Jul 22, 2010 at 7:20 PM, Tomas Härdin <[email protected] > >wrote: > > > > > On Thu, 2010-07-22 at 18:26 +0900, Nhat Huy wrote: > > > > My input file points to a ES bitstream, that's why I can not pass a > char* > > > > file name to av_open_input_file. > > > > > > > > Any helps will appreciated. > > > > Thanks. > > > > > > > > > > > > > > > > On Thu, Jul 22, 2010 at 6:18 PM, Nhat Huy <[email protected]> > wrote: > > > > > > > > > Hi all, > > > > > > > > > > I have a problem with the function av_open_input_file. > > > > > > > > > > As normal , we can use it like this: > > > > > > > > > > if(av_open_input_file(&pFormatCtx, argv[1], NULL, 0, NULL)!=0) > > > > > return -1; // Couldn't open file > > > > > > > > > > My problem is that I can not pass argv[1] into this function, now I > > > have to > > > > > pass a file pointer, which already is opened by fopen in another > > > function. > > > > > > > > > > Can anyone help me with this problem ? I stuck with it. > > > > > > > > > > Best regards, > > > > > Huy. > > > > > > > > > > > > > > > > Check out how the "pipe" protocol works. Use fileno() to get the file > > > descriptor corresponding to the given FILE*. IIRC you do something like > > > "pipe:<fd>", like "pipe:0" to read from stdin. > > > > > > You could also possibly hack it using named pipes, but I suspect the > > > above method is the easiest. > > > > > > /Tomas > > > > > > _______________________________________________ > > > libav-user mailing list > > > [email protected] > > > https://lists.mplayerhq.hu/mailman/listinfo/libav-user > > > > > > > > > > Thanks Tomas. > > > > According to your reply. > > Is the following code right ? > > > > FILE* input; > > input = fopen(filename,"rb"); > > fd = fileno(input); > > if(av_open_input_file(&pFormatCtx, "pipe:fd", NULL, 0, NULL)!=0) > > return -1; // Couldn't open file > > > > Thank you very much. > > Huy > > Uhm.. You need to use sprintf(), like: > > char temp[32]; > sprintf(temp, "pipe:%i", fd); > if(av_open_input_file(&pFormatCtx, temp, NULL, 0, NULL)!=0) > return -1; // Couldn't open file > > /Tomas > > _______________________________________________ > libav-user mailing list > [email protected] > https://lists.mplayerhq.hu/mailman/listinfo/libav-user > > Hi Tomas, Now can I pass a bit-stream buffer instead of a file in FFmpeg ? Because my input bit-stream is stored in memory, not in a file. I stuck is this problem. Can I write my program like this? int main{ unsigned char *OutBuf; FILE* input; input = fopen(argv[1], "rb"); fread(bitStream_buffer, 1 ,length ,input); if(av_open_input_file(&pFormatCtx, bitStream_buffer, NULL, 0, NULL)!=0) ........... } Regards, Huy. _______________________________________________ libav-user mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/libav-user
