﻿

{"id":15593,"date":"2023-10-07T11:14:18","date_gmt":"2023-10-07T02:14:18","guid":{"rendered":"https:\/\/www.bitstrong.com\/jp\/?p=15593"},"modified":"2023-12-25T10:54:51","modified_gmt":"2023-12-25T01:54:51","slug":"general-forward-audio-for-windows-os","status":"publish","type":"post","link":"https:\/\/www.bitstrong.com\/jp\/general-forward-audio-for-windows-os\/","title":{"rendered":"\u3010General\u3011Forward Audio For Windows OS"},"content":{"rendered":"<p><strong><span style=\"font-size: 18pt;\">\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0<\/span><\/strong><\/p>\n<p>\/\/<br \/>\n\/\/ Device Network SDK (General)<br \/>\n\/\/ Sample Code of Forward Audio (For Windows Operating System)<br \/>\n\/\/<br \/>\n#include &lt;stdio.h&gt;<br \/>\n#include &lt;iostream&gt;<br \/>\n#include &#8220;Windows.h&#8221;<br \/>\n#include &#8220;HCNetSDK.h&#8221;<br \/>\nusing namespace std;<\/p>\n<p>void CALLBACK fVoiceDataCallBack(LONG lVoiceComHandle, char *pRecvDataBuffer, DWORD dwBufSize, BYTE byAudioFlag, void* pUser)<br \/>\n{<br \/>\n\/\/The audio data here can be the data encoded and sent by device, or the locally collected and encoded data.<br \/>\nNET_DVR_VoiceComSendData(lVoiceComHandle, pRecvDataBuffer, 80);<br \/>\n}<\/p>\n<p>void main() {<br \/>\n\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n\/\/ Initialize<br \/>\nNET_DVR_Init();<br \/>\n\/\/Set connection time and reconnection time<br \/>\nNET_DVR_SetConnectTime(2000, 1);<br \/>\nNET_DVR_SetReconnect(10000, true);<\/p>\n<p>\/\/&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br \/>\n\/\/ Log in to device<br \/>\nLONG lUserID;<\/p>\n<p>\/\/Login parameters, including device IP address, user name, password, and so on.<br \/>\nNET_DVR_USER_LOGIN_INFO struLoginInfo = {0};<br \/>\nstruLoginInfo.bUseAsynLogin = 0; \/\/Synchronous login mode<br \/>\nstrcpy(struLoginInfo.sDeviceAddress, &#8220;192.0.0.64&#8221;); \/\/IP address<br \/>\nstruLoginInfo.wPort = 8000; \/\/IP address<br \/>\nstrcpy(struLoginInfo.sUserName, &#8220;admin&#8221;); \/\/User name<br \/>\nstrcpy(struLoginInfo.sPassword, &#8220;abcd1234&#8221;); \/\/Password<\/p>\n<p>\/\/Device information, output parameters<br \/>\nNET_DVR_DEVICEINFO_V40 struDeviceInfoV40 = {0};<br \/>\nlUserID = NET_DVR_Login_V40(&amp;struLoginInfo, &amp;struDeviceInfoV40);<\/p>\n<p>if (lUserID &lt; 0)<br \/>\n{<br \/>\nprintf(&#8220;Login failed, error code: %d\\n&#8221;, NET_DVR_GetLastError());<br \/>\nNET_DVR_Cleanup();<br \/>\nreturn;<br \/>\n}<\/p>\n<p>\/\/Forward audio<br \/>\nLONG lVoiceHanle;<br \/>\nlVoiceHanle = NET_DVR_StartVoiceCom_MR_V30(lUserID, 1, fVoiceDataCallBack, NULL);<br \/>\nif (lVoiceHanle &lt; 0)<br \/>\n{<br \/>\nprintf(&#8220;NET_DVR_StartVoiceCom_MR_V30 error, %d!\\n&#8221;, NET_DVR_GetLastError());<br \/>\nNET_DVR_Logout(lUserID);<br \/>\nNET_DVR_Cleanup();<br \/>\nreturn;<br \/>\n}<\/p>\n<p>Sleep(5000); \/\/millisecond<br \/>\n\/\/Stop forwarding audio<br \/>\nif (!NET_DVR_StopVoiceCom(lVoiceHanle))<br \/>\n{<br \/>\nprintf(&#8220;NET_DVR_StopVoiceCom error, %d!\\n&#8221;, NET_DVR_GetLastError());<br \/>\nNET_DVR_Logout(lUserID);<br \/>\nNET_DVR_Cleanup();<br \/>\nreturn;<br \/>\n}<\/p>\n<p>\/\/Log out<br \/>\nNET_DVR_Logout(lUserID);<br \/>\n\/\/Release SDK resource<br \/>\nNET_DVR_Cleanup();<br \/>\nreturn;<br \/>\n}<\/p>\n","protected":false},"excerpt":{"rendered":"\u30b5\u30f3\u30d7\u30eb\u30d7\u30ed\u30b0\u30e9\u30e0 \/\/ \/\/ Device Network SDK (General) \/\/ Sample Code of Forward Audio (For Windows Operating System) \/\/ #include &lt;stdio.h&gt; #include &lt;iostr...","protected":false},"author":2,"featured_media":15936,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_sitemap_exclude":false,"_sitemap_priority":"","_sitemap_frequency":"","footnotes":""},"categories":[107],"tags":[],"class_list":["post-15593","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-camera-connection"],"_links":{"self":[{"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts\/15593","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/comments?post=15593"}],"version-history":[{"count":4,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts\/15593\/revisions"}],"predecessor-version":[{"id":16301,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/posts\/15593\/revisions\/16301"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/media\/15936"}],"wp:attachment":[{"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/media?parent=15593"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/categories?post=15593"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bitstrong.com\/jp\/wp-json\/wp\/v2\/tags?post=15593"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}