00001 /* 00002 * Copyright 2008-2010 Arsen Chaloyan 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 * 00016 * $Id: mpf_stream_descriptor.h 1474 2010-02-07 20:51:47Z achaloyan $ 00017 */ 00018 00019 #ifndef MPF_STREAM_DESCRIPTOR_H 00020 #define MPF_STREAM_DESCRIPTOR_H 00021 00022 /** 00023 * @file mpf_stream_descriptor.h 00024 * @brief MPF Stream Descriptor 00025 */ 00026 00027 #include "mpf_codec_descriptor.h" 00028 00029 APT_BEGIN_EXTERN_C 00030 00031 /** Stream capabilities declaration */ 00032 typedef struct mpf_stream_capabilities_t mpf_stream_capabilities_t; 00033 00034 /** Stream directions (none, send, receive, duplex) */ 00035 typedef enum { 00036 STREAM_DIRECTION_NONE = 0x0, /**< none */ 00037 STREAM_DIRECTION_SEND = 0x1, /**< send (sink) */ 00038 STREAM_DIRECTION_RECEIVE = 0x2, /**< receive (source) */ 00039 00040 STREAM_DIRECTION_DUPLEX = STREAM_DIRECTION_SEND | STREAM_DIRECTION_RECEIVE /**< duplex */ 00041 } mpf_stream_direction_e; 00042 00043 00044 /** Stream capabilities */ 00045 struct mpf_stream_capabilities_t { 00046 /** Supported directions either send, receive or bidirectional stream (bitmask of mpf_stream_direction_e) */ 00047 mpf_stream_direction_e direction; 00048 /** Codec capabilities (supported codecs and named events) */ 00049 mpf_codec_capabilities_t codecs; 00050 }; 00051 00052 /** Create stream capabilities */ 00053 MPF_DECLARE(mpf_stream_capabilities_t*) mpf_stream_capabilities_create(mpf_stream_direction_e directions, apr_pool_t *pool); 00054 00055 /** Create source stream capabilities */ 00056 static APR_INLINE mpf_stream_capabilities_t* mpf_source_stream_capabilities_create(apr_pool_t *pool) 00057 { 00058 return mpf_stream_capabilities_create(STREAM_DIRECTION_RECEIVE,pool); 00059 } 00060 00061 /** Create sink stream capabilities */ 00062 static APR_INLINE mpf_stream_capabilities_t* mpf_sink_stream_capabilities_create(apr_pool_t *pool) 00063 { 00064 return mpf_stream_capabilities_create(STREAM_DIRECTION_SEND,pool); 00065 } 00066 00067 /** Clone stream capabilities */ 00068 MPF_DECLARE(mpf_stream_capabilities_t*) mpf_stream_capabilities_clone(const mpf_stream_capabilities_t *src_capabilities, apr_pool_t *pool); 00069 00070 /** Merge stream capabilities */ 00071 MPF_DECLARE(apt_bool_t) mpf_stream_capabilities_merge(mpf_stream_capabilities_t *capabilities, const mpf_stream_capabilities_t *src_capabilities, apr_pool_t *pool); 00072 00073 00074 /** Get reverse direction */ 00075 static APR_INLINE mpf_stream_direction_e mpf_stream_reverse_direction_get(mpf_stream_direction_e direction) 00076 { 00077 mpf_stream_direction_e rev_direction = direction; 00078 if(rev_direction == STREAM_DIRECTION_SEND) { 00079 rev_direction = STREAM_DIRECTION_RECEIVE; 00080 } 00081 else if(rev_direction == STREAM_DIRECTION_RECEIVE) { 00082 rev_direction = STREAM_DIRECTION_SEND; 00083 } 00084 return rev_direction; 00085 } 00086 00087 00088 APT_END_EXTERN_C 00089 00090 #endif /* MPF_STREAM_DESCRIPTOR_H */