Port na MacOS X.

This commit is contained in:
hopet
2007-11-21 17:28:08 +00:00
parent 71ce2a3663
commit 76d63f81bf
8 changed files with 4024 additions and 3989 deletions

View File

@@ -1,3 +1,8 @@
/*
* Define OS
*/
#undef HAVE_MACOSX
/*
* Define this if you want IPv6 support.
*/

7918
ultragrid/configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -16,6 +16,14 @@ AC_C_CHAR_UNSIGNED
AC_CHECK_HEADERS(stropts.h sys/filio.h sys/wait.h)
# -------------------------------------------------------------------------------------------------
case "$host_os" in
*darwin*)
AC_DEFINE(HAVE_MACOSX)
;;
esac
# -------------------------------------------------------------------------------------------------
# Check for standard size types. The defaults are only valid on some
# systems so we hope that <inttypes.h> exists when they're wrong.
@@ -291,11 +299,20 @@ AC_SUBST(DVS_LIB)
# -------------------------------------------------------------------------------------------------
# SDL Stuff
AC_CHECK_HEADERS([SDL/SDL.h],
[AC_CHECK_LIB(SDL, main, LIBS="$LIBS -lSDL", echo "SDL library not found or not usable.")],
[echo "SDL.h not found."]
)
case "$host_os" in
*darwin*)
AC_CHECK_HEADERS([SDL/SDL.h],
[AC_CHECK_FILE(/Library/Frameworks/SDL.framework/SDL, $LIBS="$LIBS -framework SDL", echo "SDL framework not found.")],
[echo "SDL.h not found."]
)
;;
*)
AC_CHECK_HEADERS([SDL/SDL.h],
[AC_CHECK_LIB(SDL, main, LIBS="$LIBS -lSDL", echo "SDL library not found or not usable.")],
[echo "SDL.h not found."]
)
;;
esac
# -------------------------------------------------------------------------------------------------
# OpenGL stuff

View File

@@ -7,8 +7,8 @@
* Copyright (c) 1995-2001 University College London
* All rights reserved.
*
* $Revision: 1.1 $
* $Date: 2007/11/08 09:48:58 $
* $Revision: 1.2 $
* $Date: 2007/11/21 17:28:08 $
*/
#include "config.h"
@@ -25,7 +25,9 @@
#include "audio_hw/solaris.h"
#include "audio_hw/solaris_osprey.h"
#include "audio_hw/linux_oss.h"
#ifdef HAVE_ALSA_AUDIO
#include "audio_hw/linux_alsa.h"
#endif /* HAVE_ALSA_AUDIO */
#include "audio_hw/linux_ixj.h"
#include "audio_hw/irix.h"
#include "audio_hw/win32.h"

View File

@@ -1,4 +1,9 @@
/* src/config.h.in. Generated from configure.in by autoheader. */
/*
* Define OS
*/
#undef HAVE_MACOSX
/*
* Define this if you want IPv6 support.
*/
@@ -167,7 +172,7 @@
/* Define to `signed char' if <sys/types.h> does not define. */
#undef int8_t
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* Define to `unsigned' if <sys/types.h> does not define. */
#undef size_t
/* Define to `unsigned short' if <sys/types.h> does not define. */

View File

@@ -40,8 +40,8 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Revision: 1.1 $
* $Date: 2007/11/08 09:48:59 $
* $Revision: 1.2 $
* $Date: 2007/11/21 17:28:08 $
*
*/
@@ -291,9 +291,11 @@ main(int argc, char *argv[])
return EXIT_FAIL_CAPTURE;
}
#ifdef HAVE_FASTDXT
if (requested_compression) {
compression=initialize_video_compression();
}
#endif /* HAVE_FASTDXT */
if ((network_device = initialize_network(argv[0], participants)) == NULL) {
printf("Unable to open network\n");
@@ -330,9 +332,11 @@ main(int argc, char *argv[])
rtp_update(network_device, curr_time);
rtp_send_ctrl(network_device, ts, 0, curr_time);
#ifdef HAVE_SDL
if (strcmp(requested_display, "sdl") == 0) {
display_sdl_handle_events();
}
#endif /* HAVE_SDL */
/* Receive packets from the network... The timeout is adjusted */
/* to match the video capture rate, so the transmitter works. */
@@ -375,8 +379,10 @@ main(int argc, char *argv[])
toggel=0;
//TODO: Unghetto this
if(requested_compression) {
#ifdef HAVE_FASTDXT
compress_data(compression,tx_frame);
dxt_tx_send(tx, tx_frame, network_device);
#endif /* HAVE_FASTDXT */
}else{
tx_send(tx, tx_frame, network_device);
}

View File

@@ -39,8 +39,8 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Revision: 1.1 $
* $Date: 2007/11/08 09:48:59 $
* $Revision: 1.2 $
* $Date: 2007/11/21 17:28:08 $
*
*/
@@ -61,6 +61,16 @@
extern long packet_rate;
#if HAVE_MACOSX
#define GET_STARTTIME gettimeofday(&start, NULL)
#define GET_STOPTIME gettimeofday(&stop, NULL)
#define GET_DELTA delta = (stop.tv_usec - start.tv_usec) * 1000L
#else /* HAVE_MACOSX */
#define GET_STARTTIME clock_gettime(CLOCK_REALTIME, &start)
#define GET_STOPTIME clock_gettime(CLOCK_REALTIME, &stop)
#define GET_DELTA delta = stop.tv_nsec - start.tv_nsec
#endif /* HAVE_MACOSX */
struct video_tx {
uint32_t magic;
unsigned mtu;
@@ -161,15 +171,19 @@ dxt_tx_send(struct video_tx *tx, struct video_frame *frame, struct rtp *rtp_sess
/* Is it time to send this packet? */
if ((y == (int)DXT_HEIGHT) || (payload_count == 10) || ((40u + data_len + (8u * (payload_count + 1)) + DXT_DEPTH) > tx->mtu)) {
#if HAVE_MACOSX
struct timeval start, stop;
#else /* HAVE_MACOSX */
struct timespec start, stop;
#endif /* HAVE_MACOSX */
long delta;
payload_hdr[payload_count - 1].flags = htons(1<<15);
data = frame->data + (first_y * DXT_WIDTH * DXT_DEPTH) + (first_x * DXT_DEPTH);
clock_gettime(CLOCK_REALTIME, &start);
GET_STARTTIME;
rtp_send_data_hdr(rtp_session, ts, pt, m, 0, 0, (char *) payload_hdr, 8 * payload_count, data, data_len, 0, 0, 0);
do {
clock_gettime(CLOCK_REALTIME, &stop);
delta = stop.tv_nsec - start.tv_nsec;
GET_STOPTIME;
GET_DELTA;
if(delta < 0)
delta += 1000000000L;
} while(packet_rate - delta > 0);
@@ -237,15 +251,19 @@ tx_send(struct video_tx *tx, struct video_frame *frame, struct rtp *rtp_session)
/* Is it time to send this packet? */
if ((y == (int)HD_HEIGHT) || (payload_count == 10) || ((40u + data_len + (8u * (payload_count + 1)) + HD_DEPTH) > tx->mtu)) {
#if HAVE_MACOSX
struct timeval start, stop;
#else /* HAVE_MACOSX */
struct timespec start, stop;
#endif /* HAVE_MACOSX */
long delta;
payload_hdr[payload_count - 1].flags = htons(1<<15);
data = frame->data + (first_y * HD_WIDTH * HD_DEPTH) + (first_x * HD_DEPTH);
clock_gettime(CLOCK_REALTIME, &start);
GET_STARTTIME;
rtp_send_data_hdr(rtp_session, ts, pt, m, 0, 0, (char *) payload_hdr, 8 * payload_count, data, data_len, 0, 0, 0);
do {
clock_gettime(CLOCK_REALTIME, &stop);
delta = stop.tv_nsec - start.tv_nsec;
GET_STOPTIME;
GET_DELTA;
if(delta < 0)
delta += 1000000000L;
} while(packet_rate - delta > 0);

View File

@@ -38,8 +38,8 @@
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Revision: 1.1 $
* $Date: 2007/11/08 09:48:59 $
* $Revision: 1.2 $
* $Date: 2007/11/21 17:28:08 $
*
*/
@@ -91,6 +91,7 @@ static display_table_t display_device_table[] = {
display_x11_putf,
display_x11_colour
},
#ifdef HAVE_SDL
{
0,
display_sdl_probe,
@@ -118,6 +119,7 @@ static display_table_t display_device_table[] = {
display_dxt_putf,
display_dxt_colour
},
#endif /* HAVE_SDL */
#endif /* X_DISPLAY_MISSING */
#ifdef HAVE_HDSTATION
{