hello, We have a problem in our demux device getting detected.. we have writen a program code in c++ in linux. the error that it shows while compiling is that the demux device does not get detected nor does the streams. please do help us with this.. and reply immediately . thank you ,
//including libraries// #include<stdio.h> #include<stdlib.h> #include<pthread.h> #include<linux/tyoes.h> #include <unistd.h> //defining the macros// #define DEMUX_DEVICE /dev/dvb/adapter0/demux0 #define MEM_START_ADDR 0X3C00000 #define MEM_SIZE 0X1000000 #define THREAD_SLEEP_TIME 10*1000 #define MAX_SECTION_SIZE (4*1024) static unsigned int mMemSpaceHandle=-1; static pthread_mutex_t bget_mem_mutex=PTHREAD_MUTEX_INITIALIZER: static bool thread_status=FALSE; int *address; typedef struct { int pid; int BufferSize; int fd; pthread_t thread; int TimeOut; bool thread_status; }PcDmxDataType; void main() { ConfigureDevice(int pid,int buffersize,int *error,int *subcrid); } void mInitmem() { pthread_mutex_lock(&bget_mem_mutex); bpool(MEM_START_ADDR,MEM_SIZE); pthread_mutex_unlock(&bget_mem_mutex); } int mMalloc(size_t size) { pthread_mutex_lock(&bget_mem_mutex); *address=bget(size); pthread_mutex_unlock(&bget_mem_mutex); return address; } void mFree() { pthread_mutex_lock(&bget_mem_mutex); brel(address); pthread_mutex_unlock(&bget_mem_mutex); } void ConfigureDevice(int pid,int buffersize,int *error,int *subcrid) { int fd; PcDmxDataType* Filter; if(fd=(open(DEMUX_DEVICE,(O_RDWR|O_NONBLOCK)))<0); { perror("error in opening DEMUX_DEVICE"); return mMemSpaceHandle; } else { if (ioctl(fd, DMX_SET_BUFFER_SIZE, BufferSize) == -1) { printf("Error while setting the buffer size!!!\n"); } else { Filter = (PcDmxDataType*)mMallocMem(sizeof(PcDmxDataType)); if(Filter != NULL) { struct dmx_pes_filter_params fp; memset(Filter,0,DMX_SET_BUFFER_SIZE); fp.input = DMX_IN_FRONTEND; fp.output = DMX_OUT_TAP; fp.pes_type = DMX_PES_OTHER; fp.flags = DMX_IMMEDIATE_START; fp.pid = pid; if (ioctl(fd,DMX_SET_FILTER,&fp) < 0) { mFree(); Filter=NULL; perror("error in setting the filter"); } else { pthread_t p; Filter->thread_status = FALSE; pthread_create(&p, NULL, pcdmx_pes_thread, (void*)Filter); Filter->thread = p; } } } close(fd); } } void *pcdmx_pes_thread(void* arg) { PcDmxDataType *Filter = (PcDmxDataType*)arg; int *buf; int bytes; int length=0; while(!Filter->thread_status) { usleep(THREAD_SLEEP_TIME); buf = (int*)mMallocMem(MAX_SECTION_SIZE); if(buf == NULL) continue; bytes = read(Filter->fd, buf, MAX_SECTION_SIZE); length=length+bytes; if (bytes < 0) { mFreeMem(buf); } } void *handle=NULL; handle=fopen("/home/lakshmi/1stapp.txt","wb"); fwrite(handle,size(int),length,buf); fclose(handle); }
_______________________________________________ linux-dvb users mailing list For V4L/DVB development, please use instead linux-media@xxxxxxxxxxxxxxx linux-dvb@xxxxxxxxxxx http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb