[FFmpeg-devel] Extension of pipe url
Måns Rullgård
mans
Wed Aug 15 13:59:41 CEST 2007
Michael Niedermayer wrote:
> Hi
>
> On Wed, Aug 15, 2007 at 01:12:04PM +0200, Vincent Fourmond wrote:
>>
>> Hello all,
>>
>> I am currently writing a program doing a fairly complex manipulation
>> of audio/video streams, and I needed to improve the current pipe: URL. I
>> neede something of the like:
>>
>> pipe:9
>>
>> where 9 will be interpreted as a file descriptor number. The attached
>> patch does the trick - I hope you'll find it worthy for inclusion ! You
>> can try it out with the following shell command:
>>
>> ffmpeg -f avi -i pipe:9 out.avi 9< in.avi
>>
>> Thanks,
>>
>> Vincent
>>
>> --
>> Vincent Fourmond, Doctor in Physics
>> http://vincent.fourmond.neuf.fr/
>
>> Index: libavformat/file.c
>> ===================================================================
>> --- libavformat/file.c (revision 10118)
>> +++ libavformat/file.c (working copy)
>> @@ -23,6 +23,7 @@
>> #include <fcntl.h>
>> #include <unistd.h>
>> #include <sys/time.h>
>> +#include <stdlib.h>
>>
>>
>> /* standard file protocol */
>> @@ -90,12 +91,18 @@
>> static int pipe_open(URLContext *h, const char *filename, int flags)
>> {
>> int fd;
>> + const char * final;
>> + av_strstart(filename, "pipe:", &filename);
>>
>> - if (flags & URL_WRONLY) {
>> - fd = 1;
>> - } else {
>> - fd = 0;
>> - }
>> + fd = strtol(filename, &final, 10);
>> + if(filename == final) /* No digits found */
>> + {
>> + if (flags & URL_WRONLY) {
>> + fd = 1;
>> + } else {
>> + fd = 0;
>> + }
>> + }
>
> tabs are forbidden in ffmpeg svn also the indention change of the existing
> code should be in a seperate patch
And indentation style should be consistent and sane. That is, GNU style
is not tolerable.
--
M?ns Rullg?rd
mans at mansr.com
More information about the ffmpeg-devel
mailing list