[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/extragear/kde3/multimedia/kaffeine/src/input/dvb
From:       Christophe Thommeret <hftom () free ! fr>
Date:       2008-07-06 3:17:22
Message-ID: 1215314242.307966.5938.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 828526 by thommeret:

let stdcam reset the cam and sleep a bit beetween cam poll, hopefully fixes clone issues:)

 M  +3 -86     dvbcam.cpp  


--- branches/extragear/kde3/multimedia/kaffeine/src/input/dvb/dvbcam.cpp #828525:828526
@@ -179,101 +179,17 @@
 
 void DvbCam::run()
 {
-	int i, reset_loop, query_loop, state_loop;
-	bool cam_ready = false;
+	int i;
 
 	fprintf(stderr, "CamThread: started\n");
 
-	int ca_fd = dvbca_open(Adapter, CaDevice);
-	if ( ca_fd<0 ) {
-		fprintf( stderr, "CamThread: [error] opening ca device failed\n" );
-		return;
-	}
-
-	//fprintf(stderr, "CamThread: just using the first cam slot\n");
-
-	reset_loop=0;
-	while ( isRunning && reset_loop++<6 && !cam_ready ) {
-		if ( ciType!=CA_CI ) { // do not reset HLCI
-			if ( dvbca_reset(ca_fd, 0) ) {
-				fprintf( stderr, "CamThread: [error] resetting cam slot failed\n" );
-				//close( ca_fd );
-				//ca_fd = -1;
-				//return;
-				usleep(1000000);
-				continue;
-			}
-			fprintf( stderr, "CamThread: reset cam slot\n" );
-		}
-
-		state_loop=0;
-		query_loop=0;
-		while ( isRunning && state_loop++<30 ) {
-			switch( dvbca_get_cam_state(ca_fd, 0) ) {
-				case DVBCA_CAMSTATE_MISSING: {
-					/*fprintf(stderr, "CamThread: [error] no cam detected\n");
-					close(ca_fd);
-					return; */ // FIXME: find a more reliable solution
-					break;
-				}
-				case DVBCA_CAMSTATE_READY: {
-					fprintf( stderr, "CamThread: cam 0 is ready\n" );
-					cam_ready = true;
-					break;
-				}
-				case DVBCA_CAMSTATE_INITIALISING: {
-					fprintf( stderr, "CamThread: cam is initialising\n" );
-					if ( ciType==CA_CI ) { // workaround needed for hlci
-						fprintf(stderr, "CamThread: cam 0 is ready [hlci workaround]\n");
-						cam_ready = true;
-					}
-					break;
-				}
-				default: {
-					if ( ++query_loop>3 ) {
-						fprintf(stderr, "CamThread: [error] querying the cam state failed\n");
-						close(ca_fd);
-						ca_fd = -1;
-						return;
-					}
-				}
-			}
-			if(cam_ready) {
-				break;
-			}
-			usleep(100000); // 100 ms
-		}
-	}
-
 	if ( isRunning ) {
-		switch(dvbca_get_interface_type(ca_fd, 0)) {
-			case DVBCA_INTERFACE_LINK: {
-				fprintf(stderr, "CamThread: LLCI cam slot detected\n");
-				break;
-			}
-			case DVBCA_INTERFACE_HLCI: {
-				fprintf(stderr, "CamThread: HLCI cam slot detected\n");
-				break;
-			}
-			default: {
-				fprintf(stderr, "CamThread: [error] unknown cam slot type\n");
-				close(ca_fd);
-				ca_fd = -1;
-				return;
-			}
-		}
-	}
-
-	close(ca_fd);
-	ca_fd = -1;
-
-	if ( isRunning ) {
 		if ( !init() ) {
 			fprintf(stderr, "CamThread: [error] cam slot initialisation failed\n");
 			return;
 		}
 	}
-	fprintf(stderr, "CamThread: cam slot initialisation done\n");
+	fprintf(stderr, "CamThread: cam slot initialised\n");
 
 	CamService *cs;
 	while ( isRunning ) {
@@ -315,6 +231,7 @@
 			}
 		}
 		sidMutex.unlock();
+		usleep( 10000 ); // sleep a bit
 	}
 
 	fprintf(stderr, "CamThread: stopping requested\n");
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic