Sorry for the delay:
Alexander Zubko wrote:
Hi.
I've been fighting to make and use ffmpeg for nearly a month. As I see
there was some guys with same problem in nearest past. But there is no
even smallest manual about this.
This is a volunteering based project. Patches to the docs most welcome.
I was successful to build it in MSVisualStudio with its native compiler.
But because I need to enable arm asm optimizations that ffmpeg has, I
need to build it normaly using your mingw32ce toolchain.
But because I'm totally new in *nix programming tools, all my steps are
like man in totaly dark room. So I'm asking for your help, people.
Here are my results for now.
1. I have successfully buit ffmpeg source files using MS Visual Studio
and mingw32ce compiler which relative path is
mingw32ce/bin/arm-wince-mingw32ce-gcc.exe. But had an access violation
error in function ff_h263_decode_init() which is called from
avcodec_open().
This error is very interesting: function ff_h263_decode_init() demands a
pointer to structure (AVCodecContext *avctx), because it needs another
pointer from this structure (MpegEncContext *s = avctx->priv_data),
access violation comes in the first assignment operation ( s->avctx =
avctx), so I think this means that avctx->priv_data is broken and points
to wrong address.
No, avctx is only an memory address, a number. It is the reading from the
address (called dereferencing) that can cause a violation.
So in this code:
s->avctx = avctx;
Only the left side of the expression can cause an access violation, because
the right side doesn't contain any dereference.
But, in function avcodec_open() it points to normally
allocated memory array. And if I change ff_h263_decode_init()
declaration to ff_h263_decode_init( AVCodecContext*, void* ) and pass
explicitly avctx->priv_data as second parameter - function
ff_h263_decode_init() does its job without any access violations.
2. By second step, I've built ffmpeg under msys/mingw using mingw32ce
toolchain and binary files of mingw32ce downloaded form SourceFourge
mingw32ce-0.10.0.20070208-cygwin.tar.gz and dll libraries of cygwin to
provide running of mingw32ce tools. I've used next command line
parameters to configure it
This is a somewhat old release. We just released 0.50. No binaries yet
for Cygwin, but I hope to take care of that this week, unless someone
beats me to it.
./configure --cross-compile
--cross-prefix=/opt/mingw32ce/arm-wince-mingw32ce/bin/ --enable-gpl
--disable-armv5te --disable-armv6 --disable-iwmmxt --disable-debug
--arch=armv4l --enable-static --disable-shared --disable-ipv6
--prefix=/usr/local/wince --log=no --disable-encoders --disable-decoders
--disable-parsers --disable-muxers --disable-demuxers
--disable-protocols --disable-ffplay --disable-ffserver
--disable-ffmpeg --disable-network --enable-decoder=mpeg4
--enable-decoder=h263 --enable-parser=h263 --enable-parser=mpeg4video
--disable-opts --enable-memalign-hack
then
make
and then grabbed .a files, and linked them to MSVC project, but for my
dissapointment I've got the same access violation error as i had with
the 1st try. :(
also I linked with
"opt/mingw32ce/lib/gcc/arm-wince-mingw32ce/4.1.0/libgcc.a" and
"opt/mingw32ce/arm-wince-mingw32ce/lib/libmingwex.a".
I don't know maybe I've choosed wrong libraries, or used wrong
compiller, as there are two bin folders in mingw32ce folder, and what is
the difference between them I don't know.
3. Then after two fails with mingw32ce I tried to build ffmpeg with
cegcc toolchain.
Don't go this way, it will be even harder.
I've used the same configure string except
--cross-prefix=/opt/cegcc/bin/arm-wince-cegcc- and
Compilation was done successfully, but in MS Visual Studio I get
constantly stack overflow error even before WinMain call ( I got it
earlier with mingw32ce, when I choosed wrong libraries to link with) But
now I tried different combination of libraies and it did not helped me.
Can you wrote with what libraries I must link in MS Visual Studio if I
has following unressolved symbols:
snprintf, __divsi3 and other mathematical operations and functions,
__ctype_ptr?
Build ffmpeg as shared (.dll), and use that from MSVC. Linking a static
lib between different compilers isn't guarantied to work. A dll with
mingw32ce *should* work.
A few months ago, I tried building ffmpeg with mingw32ce. Attached is my
build script and a patch into a checkout from 2007-01-21. It is hardly
complete, but is did build cleanly. Off the top of my head, at least
the open calls must be inspected and changed
from:
if (open () < 0)
to:
if (open () == -1).
I never tried running it. Daniel Alm did some progress there, but I
don't know how far did he go.
--
Cheers,
Pedro Alves
#!/usr/bin/bash
#../ffmpeg-checkout-2007-01-21/configure \
# --enable-mingwce \
# --cross-compile \
# --cross-prefix=arm-wince-mingw32ce- \
# --arch=arm \
# --target-os=WinCE \
# --disable-static \
# --enable-shared
../ffmpeg-checkout-2007-01-21/configure \
--cross-compile \
--cross-prefix=arm-wince-mingw32ce- \
--arch=arm \
--target-os=WinCE \
--enable-small \
--prefix=/opt/mingw32ce/ffmpeg \
--disable-mmx \
--disable-zlib \
--disable-network \
--disable-ipv6 \
--disable-ffmpeg --disable-ffserver --disable-ffplay \
--disable-vhook --disable-encoders --disable-muxers \
--disable-decoders --disable-demuxers --disable-parsers \
--enable-demuxer=asf \
--enable-decoder=wmav1 --enable-decoder=wmav2 \
--enable-demuxer=mpc \
--enable-decoder=mpc7 \
--disable-static \
--enable-shared
# --extra-cflags="-D_UNICODE -DUNICODE" \
# --disable-debug \
Index: configure
===================================================================
--- configure (revision 7594)
+++ configure (working copy)
@@ -103,6 +103,7 @@ show_help(){
echo " --source-path=PATH path to source code [$source_path]"
echo " --cross-prefix=PREFIX use PREFIX for compilation tools [$cross_prefix]"
echo " --cross-compile assume a cross-compiler is used"
+ echo " --target-os Set the target OS. Only valid when cross compiling."
echo " --cc=CC use C compiler CC [$cc]"
echo " --make=MAKE use specified make [$make]"
echo " --extra-cflags=ECFLAGS add ECFLAGS to CFLAGS [$CFLAGS]"
@@ -661,8 +662,24 @@ memalign_hack="no"
asmalign_pot="unknown"
LIB_INSTALL_EXTRA_CMD='$(RANLIB) "$(libdir)/$(LIB)"'
+# Handle these earlier, the rest will be handled after setting
+# the target OS defaults.
+for opt do
+ optval="${opt#*=}"
+ case "$opt" in
+ --cross-compile) cross_compile=yes
+ ;;
+ --target-os=*) targetos="$optval"
+ ;;
+ esac
+done
+
# OS specific
+
+if [ "$cross_compile" != "yes" ]; then
targetos=`uname -s`
+fi
+
case $targetos in
BeOS)
PREFIX="/boot/home/config"
@@ -777,6 +794,11 @@ SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME).$(LIBMAJOR)$(SLIBSUF)'
FFSERVERLDFLAGS=-Wl,-bind_at_load
;;
+WinCE* | MINGW32CE*)
+mingw32="yes"
+wince="yes"
+add_extralibs "-lmmtimer"
+;;
MINGW32*)
# Note: the rest of the mingw32 config is done afterwards as mingw32
# can be forced on the command line for Linux cross compilation.
@@ -891,6 +913,8 @@ for opt do
;;
--cross-compile) cross_compile=yes
;;
+ --target-os=*) targetos="$optval"
+ ;;
--cc=*) cc="$optval"
;;
--make=*) make="$optval"
@@ -1105,7 +1129,14 @@ EOF
EXESUF=".exe"
SLIBNAME_WITH_VERSION='$(SLIBPREF)$(NAME)-$(LIBVERSION)$(SLIBSUF)'
SLIBNAME_WITH_MAJOR='$(SLIBPREF)$(NAME)-$(LIBMAJOR)$(SLIBSUF)'
- SLIB_EXTRA_CMD="-lib /machine:i386 /def:\$(@:${SLIBSUF}=.def)"
+
+ case "$arch" in
+ x86_32) machine="i386" ;;
+ arm*) machine="arm" ;;
+ mips) machine="mips" ;;
+ sh4) machine="sh4" ;;
+ esac
+ SLIB_EXTRA_CMD="-lib /machine:$machine /def:\$(@:${SLIBSUF}=.def)"
SLIB_INSTALL_EXTRA_CMD="-install -m 644 \$(SLIBNAME_WITH_MAJOR:\$(SLIBSUF)=.lib) \"\$(shlibdir)/\$(SLIBNAME_WITH_MAJOR:\$(SLIBSUF)=.lib)\""
SHFLAGS="-shared -Wl,--output-def,\$(@:${SLIBSUF}=.def),--out-implib,lib\$(SLIBNAME:\$(SLIBSUF)=.dll.a) -Wl,--enable-runtime-pseudo-reloc"
fi
@@ -1832,6 +1863,7 @@ if test "$gpl" = "no" ; then
else
echo "License: GPL"
fi
+echo "Target OS $targetos"
echo "Creating config.mak and config.h..."
Index: ffmpeg.c
===================================================================
--- ffmpeg.c (revision 7594)
+++ ffmpeg.c (working copy)
@@ -19,7 +19,9 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define HAVE_AV_CONFIG_H
+#ifndef __MINGW32CE__
#include <signal.h>
+#endif
#include <limits.h>
#include "avformat.h"
#include "swscale.h"
@@ -303,6 +305,7 @@ static void term_exit(void)
#endif
}
+#if defined (SIGINT) || defined (SIGTERM)
static volatile sig_atomic_t received_sigterm = 0;
static void
@@ -311,6 +314,7 @@ sigterm_handler(int sig)
received_sigterm = sig;
term_exit();
}
+#endif
static void term_init(void)
{
@@ -333,8 +337,13 @@ static void term_init(void)
signal(SIGQUIT, sigterm_handler); /* Quit (POSIX). */
#endif
+#ifdef SIGINT
signal(SIGINT , sigterm_handler); /* Interrupt (ANSI). */
+#endif
+#ifdef SIGTERM
signal(SIGTERM, sigterm_handler); /* Termination (ANSI). */
+#endif
+
/*
register a function to be called at normal program termination
*/
@@ -347,7 +356,9 @@ static void term_init(void)
/* read a key without blocking */
static int read_key(void)
{
-#ifdef __MINGW32__
+#ifdef __MINGW32CE__
+ return getchar();
+#elif defined __MINGW32__
if(kbhit())
return(getch());
#else
@@ -1833,7 +1844,11 @@ static int av_encode(AVFormatContext **o
stream_no_data = 0;
key = -1;
+#ifndef __MINGW32CE__
for(; received_sigterm == 0;) {
+#else
+ for(;;) {
+#endif
int file_index, ist_index;
AVPacket pkt;
double ipts_min;
@@ -3967,12 +3982,14 @@ int main(int argc, char **argv)
powerpc_display_perf_report();
#endif /* POWERPC_PERFORMANCE_REPORT */
+#ifndef __MINGW32CE__
if (received_sigterm) {
fprintf(stderr,
"Received signal %d: terminating.\n",
(int) received_sigterm);
exit (255);
}
+#endif
exit(0); /* not all OS-es handle main() return value */
return 0;
Index: libavutil/bswap.h
===================================================================
--- libavutil/bswap.h (revision 7594)
+++ libavutil/bswap.h (working copy)
@@ -116,7 +116,7 @@ static av_always_inline uint16_t bswap_1
#ifdef ARCH_ARM
static av_always_inline uint32_t bswap_32(uint32_t x){
- uint32_t t;
+ uint32_t t = 0;
__asm__ (
"eor %1, %0, %0, ror #16 \n\t"
"bic %1, %1, #0xFF0000 \n\t"
Index: libavutil/common.h
===================================================================
--- libavutil/common.h (revision 7594)
+++ libavutil/common.h (working copy)
@@ -37,11 +37,12 @@
# include <string.h>
# include <ctype.h>
# include <limits.h>
-# ifndef __BEOS__
-# include <errno.h>
-# else
+# ifdef __BEOS__
# include "berrno.h"
+# elif !defined __MINGW32CE__
+# include <errno.h>
# endif
+
# include <math.h>
#endif /* HAVE_AV_CONFIG_H */
Index: libavcodec/dv.c
===================================================================
--- libavcodec/dv.c (revision 7594)
+++ libavcodec/dv.c (working copy)
@@ -39,6 +39,7 @@
#include "mpegvideo.h"
#include "simple_idct.h"
#include "dvdata.h"
+#include "libavformat/avio.h"
//#undef NDEBUG
//#include <assert.h>
Index: libavcodec/sonic.c
===================================================================
--- libavcodec/sonic.c (revision 7594)
+++ libavcodec/sonic.c (working copy)
@@ -21,6 +21,7 @@
#include "avcodec.h"
#include "bitstream.h"
#include "golomb.h"
+#include "libavformat/avio.h"
/**
* @file sonic.c
Index: libavcodec/g726.c
===================================================================
--- libavcodec/g726.c (revision 7594)
+++ libavcodec/g726.c (working copy)
@@ -25,6 +25,7 @@
#include "avcodec.h"
#include "common.h"
#include "bitstream.h"
+#include "libavformat/avio.h"
/**
* G.726 11bit float.
Index: libavcodec/gifdec.c
===================================================================
--- libavcodec/gifdec.c (revision 7594)
+++ libavcodec/gifdec.c (working copy)
@@ -25,6 +25,7 @@
#include "avcodec.h"
#include "bytestream.h"
#include "lzw.h"
+#include "libavformat/avio.h"
#define GCE_DISPOSAL_NONE 0
#define GCE_DISPOSAL_INPLACE 1
Index: libavformat/utils.c
===================================================================
--- libavformat/utils.c (revision 7594)
+++ libavformat/utils.c (working copy)
@@ -2685,7 +2685,6 @@ int parse_frame_rate(int *frame_rate, in
* S+[.m...]
* @endcode
*/
-#ifndef CONFIG_WINCE
int64_t parse_date(const char *datestr, int duration)
{
const char *p;
@@ -2793,7 +2792,6 @@ int64_t parse_date(const char *datestr,
}
return negative ? -t : t;
}
-#endif /* CONFIG_WINCE */
/**
* Attempts to find a specific tag in a URL.
Index: libavformat/avio.h
===================================================================
--- libavformat/avio.h (revision 7594)
+++ libavformat/avio.h (working copy)
@@ -202,6 +202,15 @@ int udp_set_remote_url(URLContext *h, co
int udp_get_local_port(URLContext *h);
int udp_get_file_handle(URLContext *h);
+#ifdef __MINGW32CE__
+# define EPIPE 2
+# define EAGAIN 3
+# define ENOENT 4
+# define ENOMEM 5
+# define EINVAL 6
+# define EIO 7
+#endif
+
/* tcp.c */
extern URLProtocol tcp_protocol;
Index: libavformat/framehook.c
===================================================================
--- libavformat/framehook.c (revision 7594)
+++ libavformat/framehook.c (working copy)
@@ -18,7 +18,9 @@
* License along with FFmpeg; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifndef __MINGW32CE__
#include <errno.h>
+#endif
#include "config.h"
#include "avformat.h"
#include "framehook.h"
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel