[FFmpeg-devel] Extension of pipe url
Michael Niedermayer
michaelni
Wed Aug 15 13:34:32 CEST 2007
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
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Why not whip the teacher when the pupil misbehaves? -- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070815/23c5d3aa/attachment.pgp>
More information about the ffmpeg-devel
mailing list