[Ffmpeg-devel] Network patch for MingW users
Måns Rullgård
mru
Sun Feb 4 13:21:14 CET 2007
Klaas-Pieter Vlieg <vlieg at eurescom.eu> writes:
> Attached is a ffmpeg network patch for MingW users.
> Credits go to Michael Kohn (http://www.mikekohn.net/stuff/ffmpeg.php).
> I only adapted his earlier patches to the current ffmpeg build rev.
>
> Klaas-Pieter Vlieg
>
>
> Index: patched/configure
> ===================================================================
> --- patched/configure (revision 7813)
> +++ patched/configure (working copy)
> @@ -1189,7 +1189,7 @@
> dv1394="no"
> dc1394="no"
> ffserver="no"
> - network="no"
> + extralibs="$extralibs -lws2_32"
> if enabled wince; then
> protocols="no"
> fi
This may well be correct. I don't know.
> Index: patched/libavformat/http.c
> ===================================================================
> --- patched/libavformat/http.c (revision 7813)
> +++ patched/libavformat/http.c (working copy)
> @@ -21,10 +21,12 @@
> #include "avformat.h"
> #include <unistd.h>
> #include <sys/types.h>
> +#if !defined(__MINGW32__)
> #include <sys/socket.h>
> #include <netinet/in.h>
> #include <arpa/inet.h>
> #include <netdb.h>
> +#endif
>
> #include "base64.h"
Rejected. We are working to remove all #ifdef SOME_OS hacks, and will
not accept new ones.
> Index: patched/libavformat/mpegts.c
> ===================================================================
> --- patched/libavformat/mpegts.c (revision 7813)
> +++ patched/libavformat/mpegts.c (working copy)
> @@ -1222,10 +1222,10 @@
> ts->set_service_ret = -1;
>
> /* first do a scaning to get all the services */
> - url_fseek(pb, pos, SEEK_SET);
> - mpegts_scan_sdt(ts);
> + // url_fseek(pb, pos, SEEK_SET);
> + // mpegts_scan_sdt(ts);
>
> - handle_packets(ts, s->probesize);
> + // handle_packets(ts, s->probesize);
>
> if (ts->nb_services <= 0) {
> /* no SDT found, we try to look at the PAT */
WTF is this?
[more ifdeffery]
> Index: patched/libavformat/udp.c
> ===================================================================
> --- patched/libavformat/udp.c (revision 7813)
> +++ patched/libavformat/udp.c (working copy)
> @@ -352,13 +355,32 @@
> goto fail;
>
> /* the bind is needed to give a port to the socket now */
> - if (bind(udp_fd,(struct sockaddr *)&my_addr, sizeof(my_addr)) < 0)
> - goto fail;
> +// if (bind(udp_fd,(struct sockaddr *)&my_addr, sizeof(my_addr)) < 0)
> +// goto fail;
> + t=0;
> + while(1)
> + {
> + if (bind(udp_fd,(struct sockaddr *)&my_addr, sizeof(my_addr)) < 0)
> + {
> + if (t>100) goto fail;
> + s->local_port++;
> + my_addr.sin_port = htons(s->local_port);
> + }
> + else
> + { break; }
>
> + t++;
> + }
What is this good for?
> len = sizeof(my_addr1);
> getsockname(udp_fd, (struct sockaddr *)&my_addr1, &len);
> s->local_port = ntohs(my_addr1.sin_port);
>
> +#ifdef __MINGW32__
> + tmp=65536; /* 64k UDP buffer size. Should this be bigger? */
> + setsockopt(udp_fd, SOL_SOCKET, SO_RCVBUF, &tmp, sizeof(tmp));
> +#endif
What is this supposed to do? 64k is the max UDP packet size, and the
default receive buffer should be at least that big.
--
M?ns Rullg?rd
mru at inprovide.com
More information about the ffmpeg-devel
mailing list