Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
record.c
Package: rtsp-1.0.1.tar.gz [view]
Upload User: sy_wanhua
Upload Date: 2013-07-25
Package Size: 3048k
Code Size: 2k
Category:
Streaming_Mpeg4
Development Platform:
C/C++
- #include <sys/time.h>
- #include <sys/types.h>
- #include <sys/stat.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <strings.h>
- #include <sys/ioctl.h>
- #include <unistd.h>
- #include <time.h>
- #include <fcntl.h>
- #include <errno.h>
- #include "ixjuser.h"
- void closeall(void);
- int ixj1;
- int recfile;
- int main(int argc, char *argv[])
- {
- char pname1[80], pname2[80], buff1[480], buff2[480];
- unsigned long cnt, write1;
- int size, codec, len;
- struct timeval tv1, tv2;
- time_t t1, t2;
- if(argc<4)
- {
- printf("Use: %s <ixj dev number> <filename> <codec number>n",argv[0]);
- printf(" example: %s 0 audio-file 3n",argv[0]);
- exit(0);
- }
- sprintf(pname1, "/dev/ixj%s", argv[1]);
- sprintf(pname2, "%s", argv[2]);
- printf("Reading from %s, Writing to %sn", pname1, pname2);
- ixj1 = open(pname1, O_RDONLY);
- recfile = open(pname2, O_WRONLY|O_CREAT|O_TRUNC, 0666);
- if(recfile<0)
- {
- printf("error opening file (%s)n",strerror(errno));
- exit(-1);
- } else printf("file handle %dn", recfile);
- atexit(closeall);
- if(!ioctl(ixj1, IXJCTL_RING))
- {
- exit(0);
- }
- codec = atoi(argv[3]);
- switch(codec)
- {
- case G723_63:
- len = 24;
- break;
- case G723_53:
- len = 20;
- break;
- case TS85:
- len = 32;
- break;
- case TS48:
- len = 18;
- break;
- case TS41:
- len = 16;
- break;
- case G728:
- len = 96;
- break;
- case G729:
- len = 36;
- break;
- case ULAW:
- len = 240;
- break;
- case ALAW:
- len = 240;
- break;
- case LINEAR16:
- len = 480;
- break;
- case LINEAR8:
- len = 240;
- break;
- case WSS:
- len = 240;
- break;
- }
- cnt = write1 = 0;
- ioctl(ixj1, IXJCTL_REC_CODEC, codec);
- ioctl(ixj1, IXJCTL_REC_START);
- t1 = time(NULL);
- while(ioctl(ixj1, IXJCTL_HOOKSTATE))
- {
- size = read(ixj1, buff1, len);
- if(size > 0)
- {
- write(recfile, buff1, size);
- write1++;
- }
- t2 = time(NULL);
- printf("Seconds %ldr", t2 - t1);
- fflush(stdout);
- if(t2 - t1 == 10)
- break;
- }
- }
- void closeall(void)
- {
- ioctl(ixj1, IXJCTL_REC_STOP);
- ioctl(ixj1, IXJCTL_PLAY_STOP);
- ioctl(ixj1, IXJCTL_AEC_STOP);
- close(ixj1);
- close(recfile);
- }