Theora Codec

Started by
4 comments, last by sirlemonhead 14 years, 9 months ago
Hiya, I've been looking for a video library, and Theora seems to be exactly what I need. I've downloaded it and built the library, but I can't seem to compile the playback example (player_example.c) on Windows. What's confusing me is that the code is #including <unistd.h>, which as far as I know is 'nix only (something to do with POSIX iirc?) But then further on in the example, it starts using #ifdef _WIN32... Has anyone built the Theora example on Windows? Could you share your wisdom? Any help would be much appreciated! Cheers, James
Advertisement
Have a look at liboggplayer. It's still is beta status and I'm not sure whether I'm going to spend more time on it (It didn't caught much interests). But you might find the examples useful.
As far as I know, it is indeed part of the POSIX standard, and defines "standard symbolic constants and types", like where you include <windows.h> on windows, you'd #include <unistd.h> in a POSIX app, tho I doubt they are compatible.

Maybe it's a code-glitch that there is a missing #ifdef _WIN32 nearby the inclusion. You could ofc write a patch and send it to them.

* wikipedia
MinGW also comes with a version of unistd.h for Windows. Here it is:

#ifndef _UNISTD_H/* * This file is part of the Mingw32 package. * * unistd.h maps (roughly) to io.h * Other headers included by unistd.h may be selectively processed; * __UNISTD_H_SOURCED__ enables such selective processing. */#define _UNISTD_H#define __UNISTD_H_SOURCED__ 1#include <io.h>#include <process.h>#include <getopt.h>/* These are also defined in stdio.h. */#ifndef	SEEK_SET#define SEEK_SET 0#endif#ifndef	SEEK_CUR#define SEEK_CUR 1#endif#ifndef SEEK_END#define SEEK_END 2#endif#ifdef __cplusplusextern "C" {#endif#if !defined __NO_ISOCEXT#include <sys/types.h> /* For useconds_t. */int __cdecl __MINGW_NOTHROW usleep(useconds_t useconds);#endif  /* Not __NO_ISOCEXT *//* This is defined as a real library function to allow autoconf   to verify its existence. */int ftruncate(int, off_t);__CRT_INLINE int ftruncate(int __fd, off_t __length){  return _chsize (__fd, __length);}#ifdef __cplusplus}#endif#undef __UNISTD_H_SOURCED__#endif /* _UNISTD_H */


io.h is used for non-stream IO (open, read, write, etc.) and for functions like chdir&mkdir.

process.h is used for launching processes (exec, execv etc.).

getopt.h is used for command-line options.

sys/types.h defines time_t etc.
Quote:Original post by beun
MinGW also comes with a version of unistd.h for Windows. Here it is:


Which is because MinGW is the windows port of GCC, which (as included libraries) is mostly POSIX compliant. I bet you also get a unistd.h if you install the POSIX compatibility layer by Microsoft.
You should check out liboggplay (different to the library mentioned above)

It's what Mozilla are using for Theora playback in Firefox. It greatly simplifies getting Theora playback working in whatever code you want to use it in. I've used it with DirectSound and D3D9 and it was pretty easy to get it working.

The website for it is http://www.annodex.net/ and has some old precompiled win32 binaries, but you're better off grabbing the source from their SVN. If you can get onto the freenode irc server in the room #annodex, there's usually people there who can help you out getting it working (they were a great help to me :) )

This topic is closed to new replies.

Advertisement