[FFmpeg-devel] ffmpeg on SH4

Tamas Selmeci tselmeci
Mon Dec 10 11:02:09 CET 2007

Hello all!

We're developing a software using Linux to STx7109 processor, which is 
an SH4-family member. We need strong support for audio and video 
container formats, such as MP3, AVI etc. Some of those formats are 
rather simple to implement, but some of them not so.

My first pick was GStreamer, which provides really many features, but 
hard to use, too big, has many dependencies and very slow and unreliable 
on our processor (@266 MHz).

Now I've been working with FFmpeg for 1 week, which is exactly what I 
want: many container formats and by compiling it as a shared library, 
rather small footprint.  And it's easy to use.

But I have some serious problems:

0) I've checked out the revision from 4-Dec-2007;
1) compiles perfectly under x86, but not for SH4 target. I've created a 
patch which makes it compile (I'll share if you want). The patch has so 
modifications, which make it possible to compile ffmpeg but has no 
feature fixes and so on, because the problematic parts can be found in 
libavcodec, but I don't need libavcodec at all, only libavformat.
2) sometimes my programs work with FFmpeg, sometimes not. If they're 
compiled with -fPIC and without optimization flag set, they've the 
chance to work. By eliminating -fPIC and introducing -O2, -O3, they 
won't run.

An example code:

void player2 (char * path)
     uint8_t cid;
     AVFormatContext * format;
     AVPacket * packet;

     av_register_all ();
     if (av_open_input_file (&format, path, NULL, 0, NULL))
	printf ("open error\n");

     av_find_stream_info (format);

     while (1) {
         av_read_frame (format, packet);
         printf ("size: %d\n", packet->size);
         av_free_packet (packet);

And here it generates Segmentation fault at av_read_frame. But not 
always. If this is compiled as a separate program, it's OK. But if it's 
included into our project, segfaults. Our entire project has been 
recompiled with -fPIC, and this used to work for a while. After 
modifying the code it's not working again.

I don't understand. Do you have an idea?

What I really need is the libavformat, codecs are not interesting (since 
we have an other infrastructure for this), but as far as I see, I cannot 
compile just libavformat. Maybe you know how to do this...

Did you ever expect similar behaviour? What shall I do? I like ffmpeg 
otherwise, wouldn't like to change or write container handlers...

Thank you in advance!

Best regards,
Tamas Selmeci
R&D Engineer

DENSION Audio Systems Ltd.
H-1116 Budapest, Sztregova u. 1.
Tel: +36-1-463-0470
Fax: +36-1-463-0479

mailto: tselmeci at dension.com

More information about the ffmpeg-devel mailing list