void RTMPSession::sendConnectPacket() { RTMPChunk_0 metadata = {{0}}; metadata.msg_stream_id = kControlChannelStreamId; metadata.msg_type_id = RTMP_PT_INVOKE; std::vector<uint8_t> buff; std::stringstream url ; if(m_uri.port > 0) { url << m_uri.protocol << "://" << m_uri.host << ":" << m_uri.port << "/" << m_app; } else { url << m_uri.protocol << "://" << m_uri.host << "/" << m_app; } put_string(buff, "connect"); put_double(buff, ++m_numberOfInvokes); m_trackedCommands[m_numberOfInvokes] = "connect"; put_byte(buff, kAMFObject); put_named_string(buff, "app", m_app.c_str()); put_named_string(buff,"type", "nonprivate"); put_named_string(buff, "tcUrl", url.str().c_str()); put_named_bool(buff, "fpad", false); put_named_double(buff, "capabilities", 15.); put_named_double(buff, "audioCodecs", 10. ); put_named_double(buff, "videoCodecs", 7.); put_named_double(buff, "videoFunction", 1.); put_be16(buff, 0); put_byte(buff, kAMFObjectEnd); metadata.msg_length.data = static_cast<int>( buff.size() ); sendPacket(&buff[0], buff.size(), metadata); }
void RTMPSession::sendDeleteStream() { RTMPChunk_0 metadata = {{0}}; metadata.msg_stream_id = kControlChannelStreamId; metadata.msg_type_id = RTMP_PT_INVOKE; std::vector<uint8_t> buff; put_string(buff, "deleteStream"); put_double(buff, ++m_numberOfInvokes); m_trackedCommands[m_numberOfInvokes] = "deleteStream"; put_byte(buff, kAMFNull); put_double(buff, m_streamId); metadata.msg_length.data = static_cast<int>( buff.size() ); sendPacket(&buff[0], buff.size(), metadata); }
void RTMPSession::sendPublish() { RTMPChunk_0 metadata = {{0}}; metadata.msg_stream_id = kAudioChannelStreamId; metadata.msg_type_id = RTMP_PT_INVOKE; std::vector<uint8_t> buff; std::vector<uint8_t> chunk; put_string(buff, "publish"); put_double(buff, ++m_numberOfInvokes); m_trackedCommands[m_numberOfInvokes] = "publish"; put_byte(buff, kAMFNull); put_string(buff, m_playPath); put_string(buff, "live"); metadata.msg_length.data = static_cast<int>( buff.size() ); sendPacket(&buff[0], buff.size(), metadata); }
static void put_value (Sophon_VM *vm, Sophon_IOFunc func, Sophon_Ptr data, Sophon_Value v) { if (sophon_value_is_undefined(v)) { put_u8(func, data, TAG_UNDEF); } else if (sophon_value_is_null(v)) { put_u8(func, data, TAG_NULL); } else if (sophon_value_is_bool(v)) { Sophon_Bool b; b = sophon_value_to_bool(vm, v); put_u8(func, data, TAG_BOOL); put_u8(func, data, b ? 1 : 0); } else if (sophon_value_is_string(v)) { Sophon_String *str; sophon_value_to_string(vm, v, &str); put_u8(func, data, (str->gc_flags & SOPHON_GC_FL_INTERN) ? TAG_INTERN_STRING : TAG_STRING); put_str(vm, func, data, str); } else if (sophon_value_is_number(v)) { Sophon_Number n; sophon_value_to_number(vm, v, &n); if (n == (Sophon_Number)(Sophon_Int)(n)) { put_u8(func, data, TAG_INT); put_u32(func, data, (Sophon_Int)n); } else { put_u8(func, data, TAG_DOUBLE); put_double(func, data, n); } } else { SOPHON_ASSERT(0); } }
void long_flo(value *sp) { put_double(sp, get_long(sp)); }
static void geninittype P2 (const EXPR *, ep, unsigned char *, data) { TYP *tp = ep->etp; UVAL uval; #ifdef FLOAT_SUPPORT RVAL rvl; #endif /* FLOAT_SUPPORT */ UNUSEDARG (data); switch (tp->type) { case bt_bool: put_char (ep); break; case bt_char: case bt_charu: case bt_uchar: case bt_schar: put_char (ep); break; case bt_short: case bt_ushort: case bt_int16: case bt_uint16: put_short (ep); break; case bt_pointer16: case bt_pointer32: break; case bt_bitfield: case bt_ubitfield: case bt_bbitfield: uval = ep->v.u & bitmask (bitfield_width (tp)); break; case bt_int32: case bt_uint32: case bt_ulong: case bt_long: put_long (ep); break; case bt_struct: break; case bt_union: break; #ifdef FLOAT_SUPPORT case bt_float: floatexpr (tp, &rvl); put_float (&rvl); break; case bt_double: floatexpr (tp, &rvl); put_double (&rval); break; case bt_longdouble: floatexpr (tp, &rvl); put_longdouble (&rvl); break; #endif /* FLOAT_SUPPORT */ case bt_func: break; default: break; } }
int main(int argc, char **argv) { int i; int force = 1; /* parse the options first */ for(i = 1; i < argc; i++) { if(argv[i][0] == '-') { if(argv[i][1] == '-') { /* continue parsing filenames */ force = i + 1; break; } else if(strcmp(argv[i], "-h") == 0) { fprintf(stdout, "Usage: %s [-h] [-f]\n-h: display this help message\n-f: force overwriting\n", argv[0]); return 1; } else if(strcmp(argv[i], "-f") == 0) { m_force = 1; } else { fprintf(stderr, "Unrecognized option: '%s'\n", argv[i]); return 1; } } } /* parse the filenames */ for(i = force; i < argc; i++) { if(force > 1 || argv[i][0] != '-') { if(!compile(argv[i])) { fprintf(stderr, "Error compiling map '%s'\n", argv[i]); return 1; } } } if(0) { /* unused function warning */ put_double(NULL, NULL); put_float(NULL, NULL); put_int(NULL, NULL); put_short(NULL, NULL); put_char(NULL, NULL); put_cdouble(NULL, 0); put_cfloat(NULL, 0); put_cint(NULL, 0); put_cshort(NULL, 0); put_cchar(NULL, 0); put_str(NULL, NULL, 0); } return 0; }
int write_test1(TEST_DATA *data, IO_BUFFER *iobuf) { IO_ITEM_HEADER item_header; int i; item_header.type = 99; /* test data */ item_header.version = 0; /* Version 0 (test) */ item_header.ident = 123; put_item_begin(iobuf,&item_header); put_long(data->lvar[0],iobuf); put_long(data->lvar[1],iobuf); put_long((long)data->ilvar[0],iobuf); put_long((long)data->ilvar[1],iobuf); put_short(data->isvar[0],iobuf); put_short(data->isvar[1],iobuf); put_short(data->svar[0],iobuf); put_short(data->svar[1],iobuf); put_short(data->svar[2],iobuf); put_real(data->fvar[0],iobuf); put_real(data->fvar[1],iobuf); put_double(data->dvar[0],iobuf); put_double(data->dvar[1],iobuf); put_sfloat(data->hvar[0],iobuf); put_sfloat(data->hvar[1],iobuf); put_byte(data->i8var[0],iobuf); put_byte(data->i8var[1],iobuf); put_byte(data->u8var[0],iobuf); put_byte(data->u8var[1],iobuf); put_short(data->i16var[0],iobuf); put_short(data->i16var[1],iobuf); put_short(data->u16var[0],iobuf); put_short(data->u16var[1],iobuf); put_int32(data->i32var[0],iobuf); put_int32(data->i32var[1],iobuf); put_uint32(data->u32var[0],iobuf); put_uint32(data->u32var[1],iobuf); #ifdef HAVE_64BIT_INT put_vector_of_int64(&data->i64var[0],1,iobuf); put_vector_of_int64(&data->i64var[1],1,iobuf); put_vector_of_uint64(&data->u64var[0],1,iobuf); put_vector_of_uint64(&data->u64var[1],1,iobuf); #endif put_count(data->nbvar,iobuf); put_byte(data->bvar[0],iobuf); put_byte(data->bvar[1],iobuf); for (i=0; i<4; i++) put_count16(data->cnt16var[i],iobuf); for (i=0; i<6; i++) put_count32(data->cnt32var[i],iobuf); for (i=0; i<6; i++) put_count(data->cntzvar[i],iobuf); for (i=0; i<8; i++) put_count(data->cntvar[i],iobuf); for (i=0; i<10; i++) put_scount16(data->scnt16var[i],iobuf); for (i=0; i<12; i++) put_scount32(data->scnt32var[i],iobuf); for (i=0; i<12; i++) put_scount(data->scntzvar[i],iobuf); for (i=0; i<14; i++) put_scount(data->scntvar[i],iobuf); put_string(data->str16var,iobuf); put_long_string(data->str32var,iobuf); put_var_string(data->strvvar,iobuf); return(put_item_end(iobuf,&item_header)); }
CORBA_boolean porbit_put_sv (GIOPSendBuffer *buf, CORBA_TypeCode tc, SV *sv) { switch (tc->kind) { case CORBA_tk_null: case CORBA_tk_void: return CORBA_TRUE; case CORBA_tk_short: return put_short (buf, sv); case CORBA_tk_long: return put_long (buf, sv); case CORBA_tk_ushort: return put_ushort (buf, sv); case CORBA_tk_ulong: return put_ulong (buf, sv); case CORBA_tk_float: return put_float (buf, sv); case CORBA_tk_double: return put_double (buf, sv); case CORBA_tk_char: return put_char (buf, sv); case CORBA_tk_boolean: return put_boolean (buf, sv); case CORBA_tk_octet: return put_octet (buf, sv); case CORBA_tk_enum: return put_enum (buf, tc, sv); case CORBA_tk_struct: return put_struct (buf, tc, sv); case CORBA_tk_sequence: return put_sequence (buf, tc, sv); case CORBA_tk_except: return put_except (buf, tc, sv); case CORBA_tk_objref: return put_objref (buf, tc, sv); case CORBA_tk_union: return put_union (buf, tc, sv); case CORBA_tk_alias: return put_alias (buf, tc, sv); case CORBA_tk_string: return put_string (buf, tc, sv); case CORBA_tk_array: return put_array (buf, tc, sv); case CORBA_tk_longlong: return put_longlong (buf, sv); case CORBA_tk_ulonglong: return put_ulonglong (buf, sv); case CORBA_tk_longdouble: return put_longdouble (buf, sv); case CORBA_tk_TypeCode: return put_typecode (buf, tc, sv); case CORBA_tk_any: return put_any (buf, tc, sv); case CORBA_tk_fixed: return put_fixed (buf, tc, sv); case CORBA_tk_wchar: case CORBA_tk_wstring: case CORBA_tk_Principal: default: warn ("Unsupported output typecode %d\n", tc->kind); return CORBA_FALSE; } }