Lines Matching defs:pvc
108 voss_httpd_bind_rtp(vclient_t *pvc, const char *ifname, int *pfd)
125 pvc->profile->http.rtp_vlanid = vr.vlr_tag;
127 pvc->profile->http.rtp_vlanid = 0;
188 voss_httpd_send_rtp_sub(vclient_t *pvc, int fd, void *ptr, size_t len, uint32_t ts)
193 uint16_t port = atoi(pvc->profile->http.rtp_port);
225 pkt.rtp.header8[1] = ((pvc->channels == 2) ? 10 : 11) | 0x80;
227 pkt.rtp.header16[1] = htobe16(pvc->profile->http.rtp_seqnum);
236 pvc->profile->http.rtp_seqnum++;
237 pvc->profile->http.rtp_ts += len / (2 * pvc->channels);
243 voss_httpd_send_rtp(vclient_t *pvc, int fd, void *ptr, size_t len, uint32_t ts)
245 const uint32_t mod = pvc->channels * vclient_sample_bytes(pvc);
249 voss_httpd_send_rtp_sub(pvc, fd, ptr, max, ts);
255 voss_httpd_send_rtp_sub(pvc, fd, ptr, len, ts);
259 voss_httpd_usage(vclient_t *pvc)
264 for (x = 0; x < pvc->profile->http.nstate; x++)
265 usage += (pvc->profile->http.state[x].fd != -1);
294 voss_http_generate_wav_header(vclient_t *pvc, FILE *io,
306 mod = pvc->channels * vclient_sample_bytes(pvc);
369 len = pvc->channels;
376 len = pvc->sample_rate;
385 len = pvc->sample_rate * pvc->channels * vclient_sample_bytes(pvc);
394 len = pvc->channels * vclient_sample_bytes(pvc);
401 len = vclient_sample_bytes(pvc) * 8;
410 dummy_len = pvc->sample_rate * pvc->channels * vclient_sample_bytes(pvc);
456 voss_httpd_handle_connection(vclient_t *pvc, int fd, const struct sockaddr_in *sa)
495 x = voss_httpd_usage(pvc);
526 pvc->profile->http.host, pvc->profile->http.port,
527 pvc->profile->http.host, pvc->profile->http.port);
529 if (x == pvc->profile->http.nstate)
532 fprintf(io, "<h2>There are %zu free slots (%zu active)</h2>", pvc->profile->http.nstate - x, x);
537 for (x = 0; x < pvc->profile->http.nstate; x++) {
538 if (pvc->profile->http.state[x].fd >= 0)
540 switch (voss_http_generate_wav_header(pvc, io, r_start, r_end, is_partial)) {
550 pvc->profile->http.state[x].ts =
552 pvc->profile->http.state[x].fd = fd;
577 if (sa->sin_family == AF_INET && pvc->profile->http.rtp_port != NULL) {
578 fprintf(io, "rtp://239.255.0.1:%s\r\n", pvc->profile->http.rtp_port);
581 pvc->profile->http.host, pvc->profile->http.port);
605 voss_httpd_do_listen(vclient_t *pvc, const char *host, const char *port,
640 if (listen(s, pvc->profile->http.nstate) == 0) {
658 voss_httpd_buflimit(vclient_t *pvc)
661 return ((pvc->sample_rate / 4) *
662 pvc->channels * vclient_sample_bytes(pvc));
666 voss_httpd_server(vclient_t *pvc)
668 const size_t bufferlimit = voss_httpd_buflimit(pvc);
669 const char *host = pvc->profile->http.host;
670 const char *port = pvc->profile->http.port;
675 nfd = voss_httpd_do_listen(pvc, host, port, fds, VOSS_HTTPD_BIND_MAX, bufferlimit);
704 voss_httpd_handle_connection(pvc, f, &si);
710 voss_httpd_streamer(vclient_t *pvc)
712 const size_t bufferlimit = voss_httpd_buflimit(pvc);
720 if (vclient_export_read_locked(pvc) != 0) {
724 vring_get_read(&pvc->rx_ring[1], &ptr, &len);
727 vring_reset(&pvc->rx_ring[1]);
736 if (pvc->profile->http.rtp_fd > -1) {
737 voss_httpd_send_rtp(pvc, pvc->profile->http.rtp_fd,
738 ptr, len, pvc->profile->http.rtp_ts);
742 for (x = 0; x < pvc->profile->http.nstate; x++) {
743 int fd = pvc->profile->http.state[x].fd;
744 uint64_t delta = ts - pvc->profile->http.state[x].ts;
752 pvc->profile->http.state[x].fd = -1;
755 pvc->profile->http.state[x].fd = -1;
758 pvc->profile->http.state[x].fd = -1;
763 pvc->profile->http.state[x].fd = -1;
767 pvc->profile->http.state[x].ts = ts;
772 vring_inc_read(&pvc->rx_ring[1], len);
779 vclient_t *pvc;
796 pvc = vclient_alloc();
797 if (pvc == NULL)
800 pvc->profile = pvp;
805 if (pvc->channels > 2)
809 perr = voss_httpd_bind_rtp(pvc, pvp->http.rtp_ifname,
815 error = vclient_setup_buffers(pvc, 0, 0,
821 error = vclient_setup_buffers(pvc, 0, 0, pvp->channels,
827 vclient_free(pvc);
832 pvc->rx_enabled = 1;
834 pvc->type = VTYPE_OSS_DAT;
837 TAILQ_INSERT_TAIL(&pvp->head, pvc, entry);
840 if (pthread_create(&td, NULL, (void *)&voss_httpd_server, pvc))
842 if (pthread_create(&td, NULL, (void *)&voss_httpd_streamer, pvc))