00001 /** 00002 * @class wosh::interfaces::entertainment::Video4Linux 00003 * @brief Standard interface of generic audio player (device). 00004 * 00005 * 00006 * @see wosh::entertainment::PlayerPlayerMPDBundle 00007 * @ingroup Interfaces 00008 **************************************************************************** 00009 * @version 0.8.384 $Id: Video4Linux.h 3775 2011-01-01 16:38:17Z alex $ 00010 * @author Alessandro Polo 00011 ****************************************************************************/ 00012 /* Copyright (c) 2007-2011, WOSH - Wide Open Smart Home 00013 * by Alessandro Polo - OpenSmartHome.com 00014 * All rights reserved. 00015 * 00016 * Redistribution and use in source and binary forms, with or without 00017 * modification, are permitted provided that the following conditions are met: 00018 * * Redistributions of source code must retain the above copyright 00019 * notice, this list of conditions and the following disclaimer. 00020 * * Redistributions in binary form must reproduce the above copyright 00021 * notice, this list of conditions and the following disclaimer in the 00022 * documentation and/or other materials provided with the distribution. 00023 * * Neither the name of the OpenSmartHome.com WOSH nor the 00024 * names of its contributors may be used to endorse or promote products 00025 * derived from this software without specific prior written permission. 00026 * 00027 * THIS SOFTWARE IS PROVIDED BY Alessandro Polo ''AS IS'' AND ANY 00028 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00029 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00030 * DISCLAIMED. IN NO EVENT SHALL Alessandro Polo BE LIABLE FOR ANY 00031 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00032 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00033 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00034 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00035 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00036 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00037 ****************************************************************************/ 00038 00039 #ifndef __WOSH_Interfaces_Entertainment_Video4Linux_H__ 00040 #define __WOSH_Interfaces_Entertainment_Video4Linux_H__ 00041 00042 #include <interfaces/Interface.h> 00043 00044 00045 namespace wosh { 00046 namespace interfaces { 00047 namespace entertainment { 00048 00049 #define _Video4Linux_KEY_StreamBusType "StreamBusType" 00050 #define _Video4Linux_DEFAULT_StreamBusType "wosh::BusMT" 00051 00052 #define _Video4Linux_KEY_VideoDevice "VideoDevice" 00053 00054 #define _Video4Linux_DEFAULT_VideoDevice "/dev/video0" 00055 00056 00057 class Video4Linux : public virtual Interface 00058 { 00059 WOSH_INTERFACE(wosh::interfaces::entertainment::Video4Linux) 00060 00061 /** @name Video4Linux Interface 00062 * @{ 00063 ******************************************************************************/ 00064 public: 00065 /** 00066 * @brief Connect to device. 00067 * @return VIPRET_PARAMS_ERR if inputfile is NULL, VIP_ILLEGAL_USE 00068 * if a device is already connected, VIPRET_INTERNAL_ERR 00069 * if any error occured, VIPRET_OK else. 00070 */ 00071 virtual WRESULT connectDevice( const std::string& inputFile = _Video4Linux_DEFAULT_VideoDevice, unsigned long timeout = LIMIT_ULONG_MAX ) = 0; 00072 00073 /** 00074 * @brief Disconnect from current device. 00075 * @return WRET_ERR if no device is connected, VIPRET_OK else. 00076 */ 00077 virtual WRESULT disconnectDevice( unsigned long timeout = LIMIT_ULONG_MAX ) = 0; 00078 00079 virtual WRESULT extractFrame( unsigned char* buffer, long size ) = 0; 00080 00081 virtual const std::string& getVideoDevice() const = 0; 00082 00083 //@} 00084 public: 00085 virtual ~Video4Linux() { } 00086 00087 }; // class def 00088 00089 00090 00091 class Video4LinuxListener 00092 { 00093 /** @name Video4LinuxListener interface 00094 * @{ 00095 ******************************************************************************/ 00096 public: 00097 00098 //@} 00099 public: 00100 virtual ~Video4LinuxListener() { } 00101 00102 }; // class def 00103 00104 00105 }; // namespace entertainment 00106 }; // namespace interfaces 00107 }; // namespace wosh 00108 00109 #endif //__WOSH_Interfaces_Entertainment_Video4Linux_H__