Known problems: ffmpeg.exe produces broken files, e.g. riff header is absent, huge amount of data is zero-filled etc. (other binaries such as mencoder and ffmpeg2theora work fine); the test suite looks not working because of bash.exe limitations; wma decoding causes sigill when sse is used, gcc version doesn't matter; at least inet_aton() is not a part of standard library, configure checks should use extra settings. Michael
On Mon, Dec 24, 2007 at 12:27:23AM +0300, Michael Kostylev wrote:
Known problems: ffmpeg.exe produces broken files, e.g. riff header is absent, huge amount of data is zero-filled etc. (other binaries such as mencoder and ffmpeg2theora work fine); the test suite looks not working because of bash.exe limitations; wma decoding causes sigill when sse is used, gcc version doesn't matter; at least inet_aton() is not a part of standard library, configure checks should use extra settings.
--- ffmpeg-export-2007-12-23/libavformat/os_support.c 2007-12-09 17:39:01.000000000 +0300 +++ ffmpeg-export-2007-12-23_djgpp/libavformat/os_support.c 2007-12-23 12:27:37.000000000 +0300 @@ -30,9 +30,11 @@ #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #else +#ifndef __DJGPP__ #include <sys/select.h> #endif #endif +#endif
This would need to be done with a proper check in configure and HAVE_SYS_SELECT_H instead. The configure part looks OK. Diego
At Sun, 23 Dec 2007 22:48:34 +0100, Diego Biurrun wrote:
--- ffmpeg-export-2007-12-23/libavformat/os_support.c 2007-12-09 17:39:01.000000000 +0300 +++ ffmpeg-export-2007-12-23_djgpp/libavformat/os_support.c 2007-12-23 12:27:37.000000000 +0300 @@ -30,9 +30,11 @@ #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #else +#ifndef __DJGPP__ #include <sys/select.h> #endif #endif +#endif This would need to be done with a proper check in configure and HAVE_SYS_SELECT_H instead.
Redone. Michael
On Mon, Dec 24, 2007 at 02:07:13AM +0300, Michael Kostylev wrote:
At Sun, 23 Dec 2007 22:48:34 +0100, Diego Biurrun wrote:
--- ffmpeg-export-2007-12-23/libavformat/os_support.c 2007-12-09 17:39:01.000000000 +0300 +++ ffmpeg-export-2007-12-23_djgpp/libavformat/os_support.c 2007-12-23 12:27:37.000000000 +0300 @@ -30,9 +30,11 @@ #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #else +#ifndef __DJGPP__ #include <sys/select.h> #endif #endif +#endif This would need to be done with a proper check in configure and HAVE_SYS_SELECT_H instead.
Redone.
Michael
[...]
diff -ur ffmpeg-export-2007-12-23/libavformat/os_support.h ffmpeg-export-2007-12-23_djgpp/libavformat/os_support.h --- ffmpeg-export-2007-12-23/libavformat/os_support.h 2007-11-27 14:27:50.000000000 +0300 +++ ffmpeg-export-2007-12-23_djgpp/libavformat/os_support.h 2007-12-23 12:27:37.000000000 +0300 @@ -27,7 +27,7 @@ * miscellaneous OS support macros and functions. */
-#if defined(__BEOS__) || defined(__INNOTEK_LIBC__) +#if defined(__BEOS__) || defined(__INNOTEK_LIBC__) || defined(__DJGPP__) typedef int socklen_t; #endif
ugly but thats not the fault of your patch, so that hunk is ok
diff -ur ffmpeg-export-2007-12-23/libavutil/internal.h ffmpeg-export-2007-12-23_djgpp/libavutil/internal.h --- ffmpeg-export-2007-12-23/libavutil/internal.h 2007-11-19 13:40:11.000000000 +0300 +++ ffmpeg-export-2007-12-23_djgpp/libavutil/internal.h 2007-12-24 00:08:32.000000000 +0300 @@ -118,7 +118,7 @@ #endif
// Use rip-relative addressing if compiling PIC code on x86-64. -#if defined(__MINGW32__) || defined(__CYGWIN__) || \ +#if defined(__MINGW32__) || defined(__CYGWIN__) || defined(__DJGPP__) || \ defined(__OS2__) || (defined (__OpenBSD__) && !defined(__ELF__)) # if defined(ARCH_X86_64) && defined(PIC) # define MANGLE(a) "_" #a"(%%rip)"
this too
@@ -276,8 +276,29 @@ /* btw, rintf() is existing on fbsd too -- alex */ static av_always_inline long int lrintf(float x) { - return (int)(rint(x)); + return (long int)(rint(x)); } #endif /* HAVE_LRINTF */
this looks like a unrelated bugfix -> seperate patch
+#ifdef __DJGPP__ +static av_always_inline long int lrint(double x) +{ + return (long int)(rint(x)); +} + +static av_always_inline long long llrint(double x) +{ + return (long long)(rint(x)); +} + +static av_always_inline float roundf(float x) +{ + return floorf(x + 0.5); +} +static av_always_inline double round(double x) +{ + return floor(x + 0.5); +} +#endif /* __DJGPP__ */ +
this stuff is not ok, the reason is that you add more ugly and fragile ifdeffery (which will break for example if a futue version of DJGPP adds these functions ...) each of these should be checked for by configure ... also the implementation of round* is wrong also did you or anyone else report these missing function to the djgpp maintainer/developers/whatever? it would be much better if these would be added to djgpp instead of every program which wants to be compileable under djgpp [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If a bugfix only changes things apparently unrelated to the bug with no further explanation, that is a good sign that the bugfix is wrong.
At Mon, 24 Dec 2007 04:21:50 +0100, Michael Niedermayer wrote:
this stuff is not ok, the reason is that you add more ugly and fragile ifdeffery (which will break for example if a futue version of DJGPP adds these functions ...) each of these should be checked for by configure ... also the implementation of round* is wrong
Agree, yet another "better than nothing implementation"(tm) follows.
also did you or anyone else report these missing function to the djgpp maintainer/developers/whatever? it would be much better if these would be added to djgpp instead of every program which wants to be compileable under djgpp
Looks like no one needs it. Michael
On Mon, Dec 24, 2007 at 02:24:09PM +0300, Michael Kostylev wrote:
At Mon, 24 Dec 2007 04:21:50 +0100, Michael Niedermayer wrote:
this stuff is not ok, the reason is that you add more ugly and fragile ifdeffery (which will break for example if a futue version of DJGPP adds these functions ...) each of these should be checked for by configure ... also the implementation of round* is wrong
Agree, yet another "better than nothing implementation"(tm) follows.
also did you or anyone else report these missing function to the djgpp maintainer/developers/whatever? it would be much better if these would be added to djgpp instead of every program which wants to be compileable under djgpp
Looks like no one needs it.
--- ffmpeg-export-2007-12-23/libavformat/os_support.c 2007-12-09 17:39:01.000000000 +0300 +++ ffmpeg-export-2007-12-23_djgpp/libavformat/os_support.c 2007-12-24 01:18:53.000000000 +0300 @@ -30,9 +30,11 @@ #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #else +#ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #endif #endif +#endif
What I said in the other mail still applies.
--- ffmpeg-export-2007-12-23/configure 2007-12-17 22:30:04.000000000 +0300 +++ ffmpeg-export-2007-12-23_djgpp/configure 2007-12-24 12:59:19.000000000 +0300 @@ -1584,12 +1597,14 @@
check_lib math.h sin -lm
-# test for lrintf in math.h -check_exec <<EOF && enable lrintf || disable lrintf +# test for C99 functions in math.h +for func in llrint lrint lrintf round roundf; do + check_exec <<EOF && enable $func || disable $func #define _ISOC9X_SOURCE 1 #include <math.h> -int main(void) { return (lrintf(3.999f) > 0)?0:1; } +int main(void) { return ($func(3.999) > 0)?0:1; }
You removed the "f", is this still correct?
--- ffmpeg-export-2007-12-23/libavutil/internal.h 2007-11-19 13:40:11.000000000 +0300 +++ ffmpeg-export-2007-12-23_djgpp/libavutil/internal.h 2007-12-24 13:21:25.000000000 +0300 @@ -276,8 +276,36 @@ /* btw, rintf() is existing on fbsd too -- alex */ static av_always_inline long int lrintf(float x) { - return (int)(rint(x)); + return (long int)(rint(x));
What Michael said in the other mail still applies. I just applied the third patch. Diego
On Mon, Dec 24, 2007 at 02:24:09PM +0300, Michael Kostylev wrote:
diff -ur ffmpeg-export-2007-12-23/libavutil/internal.h ffmpeg-export-2007-12-23_djgpp/libavutil/internal.h --- ffmpeg-export-2007-12-23/libavutil/internal.h 2007-11-19 13:40:11.000000000 +0300 +++ ffmpeg-export-2007-12-23_djgpp/libavutil/internal.h 2007-12-24 13:21:25.000000000 +0300 @@ -276,8 +276,36 @@ /* btw, rintf() is existing on fbsd too -- alex */ static av_always_inline long int lrintf(float x) { - return (int)(rint(x)); + return (long int)(rint(x)); } #endif /* HAVE_LRINTF */
+#ifndef HAVE_LLRINT +static av_always_inline long long llrint(double x) +{ + return (long long)(rint(x)); +} +#endif /* HAVE_LLRINT */ + +#ifndef HAVE_LRINT +static av_always_inline long int lrint(double x) +{ + return (long int)(rint(x)); +} +#endif /* HAVE_LRINT */ + +#ifndef HAVE_ROUND +static av_always_inline double round(double x) +{ + return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5); +} +#endif /* HAVE_ROUND */ + +#ifndef HAVE_ROUNDF +static av_always_inline float roundf(float x) +{ + return (float)((x > 0) ? floor(x + 0.5) : ceil(x - 0.5)); +} +#endif /* HAVE_ROUNDF */
Casts like this are ugly and unnecessary. The return statement already casts to the correct sized type. C is not C++. Rich
On Mon, Dec 24, 2007 at 02:24:09PM +0300, Michael Kostylev wrote: [...]
also did you or anyone else report these missing function to the djgpp maintainer/developers/whatever? it would be much better if these would be added to djgpp instead of every program which wants to be compileable under djgpp
Looks like no one needs it.
Well if noone needs them, then you can remove them from the patch. [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB I have often repented speaking, but never of holding my tongue. -- Xenocrates
The last try. I hope. Michael
On Tue, Dec 25, 2007 at 01:05:28AM +0300, Michael Kostylev wrote:
The last try. I hope.
Michael
[configure stuff i dont maintain]
diff -ur ffmpeg-export-2007-12-23/libavutil/internal.h ffmpeg-export-2007-12-23_djgpp/libavutil/internal.h --- ffmpeg-export-2007-12-23/libavutil/internal.h 2007-11-19 13:40:11.000000000 +0300 +++ ffmpeg-export-2007-12-23_djgpp/libavutil/internal.h 2007-12-24 13:21:25.000000000 +0300 @@ -280,4 +280,32 @@ } #endif /* HAVE_LRINTF */
+#ifndef HAVE_LLRINT +static av_always_inline long long llrint(double x) +{ + return rint(x); +} +#endif /* HAVE_LLRINT */ + +#ifndef HAVE_LRINT +static av_always_inline long int lrint(double x) +{ + return rint(x); +} +#endif /* HAVE_LRINT */ + +#ifndef HAVE_ROUND +static av_always_inline double round(double x) +{ + return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5); +} +#endif /* HAVE_ROUND */ + +#ifndef HAVE_ROUNDF +static av_always_inline float roundf(float x) +{ + return (x > 0) ? floor(x + 0.5) : ceil(x - 0.5); +} +#endif /* HAVE_ROUNDF */ + #endif /* FFMPEG_INTERNAL_H */
iam ok with this, though if i were picky i could complain that your round implementation fails for 0.49999999999999994449 amongth others but i guess its good enough. Fixing that would make it slower and uglier with no real advantage ... [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Those who are too smart to engage in politics are punished by being governed by those who are dumber. -- Plato
On Tue, Dec 25, 2007 at 01:05:28AM +0300, Michael Kostylev wrote:
The last try. I hope.
Your hope was not in vain, applied. Diego
On Mon, Dec 24, 2007 at 02:07:13AM +0300, Michael Kostylev wrote:
At Sun, 23 Dec 2007 22:48:34 +0100, Diego Biurrun wrote:
--- ffmpeg-export-2007-12-23/libavformat/os_support.c 2007-12-09 17:39:01.000000000 +0300 +++ ffmpeg-export-2007-12-23_djgpp/libavformat/os_support.c 2007-12-23 12:27:37.000000000 +0300 @@ -30,9 +30,11 @@ #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #else +#ifndef __DJGPP__ #include <sys/select.h> #endif #endif +#endif This would need to be done with a proper check in configure and HAVE_SYS_SELECT_H instead.
Redone.
--- ffmpeg-export-2007-12-23/libavformat/os_support.c 2007-12-09 17:39:01.000000000 +0300 +++ ffmpeg-export-2007-12-23_djgpp/libavformat/os_support.c 2007-12-24 01:18:53.000000000 +0300 @@ -30,9 +30,11 @@ #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #else +#ifdef HAVE_SYS_SELECT_H #include <sys/select.h> #endif #endif +#endif
Use "#elif HAVE_SYS_SELECT_H" here, that will save an #endif. Diego
participants (4)
-
dalias@aerifal.cx -
diego@biurrun.de -
michaelni@gmx.at -
mik@niipt.ru