comparison src/recpt1.c @ 133:0db6ccf0fe31

modify DLNA display name & UUID
author Naoya OYAMA <naoya.oyama@gmail.com>
date Thu, 14 Oct 2010 00:07:05 +0900
parents 5a380559a61e
children c4e0a5777363
comparison
equal deleted inserted replaced
132:7b663556757f 133:0db6ccf0fe31
52 boolean f_exit = FALSE; 52 boolean f_exit = FALSE;
53 53
54 /* prototypes */ 54 /* prototypes */
55 int tune(char *channel, thread_data *tdata, char *device); 55 int tune(char *channel, thread_data *tdata, char *device);
56 int close_tuner(thread_data *tdata); 56 int close_tuner(thread_data *tdata);
57 57 static int get_device_id_by_name ( const char *name );
58 58
59 /* ipc message receive */ 59 /* ipc message receive */
60 void * 60 void *
61 mq_recv(void *t) 61 mq_recv(void *t)
62 { 62 {
970 970
971 /* open tuner */ 971 /* open tuner */
972 /* case 1: specified tuner device */ 972 /* case 1: specified tuner device */
973 if(device) { 973 if(device) {
974 tdata->tfd = open(device, O_RDONLY); 974 tdata->tfd = open(device, O_RDONLY);
975 tdata->device_id = get_device_id_by_name(device);
975 if(tdata->tfd < 0) { 976 if(tdata->tfd < 0) {
976 fprintf(stderr, "Cannot open tuner device: %s\n", device); 977 fprintf(stderr, "Cannot open tuner device: %s\n", device);
977 return 1; 978 return 1;
978 } 979 }
979 980
1020 close(tdata->tfd); 1021 close(tdata->tfd);
1021 tdata->tfd = -1; 1022 tdata->tfd = -1;
1022 continue; 1023 continue;
1023 } 1024 }
1024 1025
1026 tdata->device_id = get_device_id_by_name(tuner[lp]);
1025 break; /* found suitable tuner */ 1027 break; /* found suitable tuner */
1026 } 1028 }
1027 } 1029 }
1028 1030
1029 /* all tuners cannot be used */ 1031 /* all tuners cannot be used */
1504 } 1506 }
1505 1507
1506 return 0; 1508 return 0;
1507 } 1509 }
1508 1510
1511 static int
1512 get_device_id_by_name
1513 ( const char *name )
1514 {
1515 int i = -1;
1516 if ( name != NULL ) {
1517 if( ! strncmp(name, DEVICE_NAME_BASE, strlen(DEVICE_NAME_BASE) ) ) {
1518 i = atoi(name+strlen(DEVICE_NAME_BASE));
1519 }
1520 }
1521 return i;
1522 }