vitooki.hpp

00001 #ifndef VITOOKI_HPP_ 00002 #define VITOOKI_HPP_ 00003 #ifdef ENABLE_FFMPEG 00004 #ifndef ISOMP4 00005 #include "avformat.h" 00006 #else 00007 #include "avcodec.h" 00008 #endif 00009 #endif //enable_ffmpeg 00010 #ifdef WIN32 00011 #include <winsock2.h> 00012 #include <stdio.h> 00013 #endif 00014 00015 00016 //used for sched.h in phtreads lib (at least win32) 00017 #ifdef WIN32 00018 typedef int pid_t; 00019 #endif 00020 00021 00022 00024 void vitooki_init_codecs() { 00025 #ifdef ENABLE_FFMPEG 00026 #ifndef ISOMP4 00027 av_register_all(); 00028 #else 00029 //init ffmpeg codecs, but not avformat 00030 avcodec_init(); 00031 avcodec_register_all(); 00032 #endif 00033 #endif 00034 } 00035 00036 00040 void vitooki_init_network() 00041 { 00042 #ifdef WIN32 00043 #ifdef WINCE 00044 WORD wVersionRequested; 00045 WSADATA wsaData; 00046 int err; 00047 00048 wVersionRequested = MAKEWORD( 2, 2 ); 00049 00050 err = WSAStartup( wVersionRequested, &wsaData ); 00051 if ( err != 0 ) { 00052 MessageBox(NULL,_T("Cannot initialize WinSock!"),_T("ERROR"),0); 00053 /* Tell the user that we could not find a usable */ 00054 /* WinSock DLL. */ 00055 return; 00056 } 00057 00058 #else 00059 // do net init for stupid windows 00060 WSADATA wsaData; 00061 if (WSAStartup(MAKEWORD(1, 1), &wsaData) != 0) { 00062 printf("Failed to init network library\r\n"); 00063 exit(1); 00064 } 00065 #endif 00066 #endif 00067 }; 00068 00070 void vitooki_init_all() 00071 { 00072 vitooki_init_codecs(); 00073 vitooki_init_network(); 00074 }; 00075 00076 #endif