[MPlayer-dev-eng] Patch for add extended channels options in tv mode

devel at pop3.ru devel at pop3.ru
Fri Jun 13 19:38:11 CEST 2008


On Fri, 13 Jun 2008 17:42:37 +0400, Vladimir Voroshilov  
<voroshil at gmail.com> wrote:

> devel at pop3.ru wrote:
>> -tv channels=<channel>-<name>[-<norm>],...
>>
>> Example:
>>   mplayer tv:// -tv
>> channels=8-TNT=PAL,11-ORT=SECAM,27-RUSSIA=SECAM,29-NTV=PAL,31-TNV=SECAM
>>
>
>
>> diff -Naur mplayer-1.0_rc2_p25993.orig/stream/tv.c  
>> mplayer-1.0_rc2_p25993/stream/tv.c
>> d--- mplayer-1.0_rc2_p25993.orig/stream/tv.c	2008-02-06  
>> 17:37:07.000000000 +0300
>> d+++ mplayer-1.0_rc2_p25993/stream/tv.c	2008-03-13 09:34:05.000000000  
>> +0300
>> d@@ -254,6 +254,7 @@
>> d     tv_channel_list->next=NULL;
>> d     tv_channel_list->prev=NULL;
>> d     tv_channel_current = tv_channel_list;
>> d+	tv_channel_current->norm = tvh->norm;
>
> Mixed spaces/tabs
>
>>
>>     while (*channels) {
>>         char* tmp = *(channels++);
>> @@ -299,6 +300,12 @@
>>             if ( sep[0] == '-' ) tv_channel_current->freq -= i * 100;
>>             sep[0] = '\0';
>>           }
>> +
>> +          sep = strchr(tv_channel_current->name, '=');
>> +          if ( sep ) {
>> +			tv_channel_current->norm = norm_from_string(tvh, sep+1);
>> +            sep[0] = '\0';
>> +          }
>
> Mixed spaces/tabs, wrong alignment
>
>>         }
>>
>>         /*mp_msg(MSGT_TV, MSGL_INFO, "-- Detected channel %s - %s  
>> (%5.3f)\n",
>> @@ -310,6 +317,7 @@
>>         tv_channel_current->next->prev = tv_channel_current;
>>         tv_channel_current->next->next = NULL;
>>         tv_channel_current = tv_channel_current->next;
>> +		tv_channel_current->norm = tvh->norm;
>
> Mixed spaces/tabs
>
>>     }
>>     if (tv_channel_current->prev)
>>         tv_channel_current->prev->next = NULL;
>> @@ -500,6 +508,7 @@
>>
>> 	mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3,  
>> tv_channel_current->number,
>> 			tv_channel_current->name, (float)tv_channel_current->freq/1000);
>> +	tv_set_norm_i(tvh, tv_channel_current->norm);
>
> But here,
>
>> 	tv_set_freq(tvh, (unsigned  
>> long)(((float)tv_channel_current->freq/1000)*16));
>> 	tv_channel_last = tv_channel_current;
>>     } else {
>> @@ -922,6 +931,8 @@
>> 				tv_channel_current = tv_channel_current->next;
>> 			else
>> 				tv_channel_current = tv_channel_list;
>> +				
>> +				tv_set_norm_i(tvh, tv_channel_current->norm);
>
> here,
>
>> 				tv_set_freq(tvh, (unsigned  
>> long)(((float)tv_channel_current->freq/1000)*16));
>> 				mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3,
>> 			tv_channel_current->number, tv_channel_current->name,  
>> (float)tv_channel_current->freq/1000);
>> @@ -933,6 +944,7 @@
>> 			else
>> 				while (tv_channel_current->next)
>> 					tv_channel_current = tv_channel_current->next;
>> +				tv_set_norm_i(tvh, tv_channel_current->norm);
>
> here,
>
>> 				tv_set_freq(tvh, (unsigned  
>> long)(((float)tv_channel_current->freq/1000)*16));
>> 				mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3,
>> 			tv_channel_current->number, tv_channel_current->name,  
>> (float)tv_channel_current->freq/1000);
>> @@ -977,6 +989,7 @@
>> 				tv_channel_current = tv_channel_current->next;
>> 		mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3,  
>> tv_channel_current->number,
>> 				tv_channel_current->name, (float)tv_channel_current->freq/1000);
>> +		tv_set_norm_i(tvh, tv_channel_current->norm);
>
> here,
>
>> 		tv_set_freq(tvh, (unsigned  
>> long)(((float)tv_channel_current->freq/1000)*16));
>> 	} else tv_set_channel_real(tvh, channel);
>> 	return(1);
>> @@ -994,6 +1007,7 @@
>>
>> 		mp_msg(MSGT_TV, MSGL_INFO, MSGTR_TV_SelectedChannel3,  
>> tv_channel_current->number,
>> 				tv_channel_current->name, (float)tv_channel_current->freq/1000);
>> +		tv_set_norm_i(tvh, tv_channel_current->norm);
>
> ..and here tabs are ok since the code around is using tabs.
> In other places you add tabs while code around is using spacing.
>
>> 		tv_set_freq(tvh, (unsigned  
>> long)(((float)tv_channel_current->freq/1000)*16));
>> 	} else {
>> 		int i;
>> @@ -1050,6 +1064,22 @@
>>     return(1);
>> }
>>
>> +int tv_set_norm_i(tvi_handle_t *tvh, int norm)
>> +{
>> +	char norm_s[5];
>> +	snprintf(norm_s, 5, "%d", norm);
>
> Spaces/tabs usage is inconsistent in the routine.
> Please select one of them (i prefer spaces)
>
>> +
>> +    tvh->norm = norm;
>
> Setting new value without checking for the result of the ioctl below
> is not good idea, imho.
>
>> +
>> +    mp_msg(MSGT_TV, MSGL_V, MSGTR_TV_SelectedNorm, norm_s);
>> +    if (tvh->functions->control(tvh->priv, TVI_CONTROL_TUN_SET_NORM,  
>> &tvh->norm) != TVI_CONTROL_TRUE) {
>> +	mp_msg(MSGT_TV, MSGL_ERR, MSGTR_TV_CannotSetNorm);
>> +	return 0;
>
> Spaces/tabs
>
>> +    }
>> +     
>> tvh->functions->control(tvh->priv,TV_VBI_CONTROL_RESET,tvh->tv_param);
>> +    return(1);
>> +}
>> +
>> demuxer_desc_t demuxer_desc_tv = {
>>   "Tv card demuxer",
>>   "tv",
>> diff -Naur mplayer-1.0_rc2_p25993.orig/stream/tv.h  
>> mplayer-1.0_rc2_p25993/stream/tv.h
>> --- mplayer-1.0_rc2_p25993.orig/stream/tv.h	2008-02-06  
>> 17:37:07.000000000 +0300
>> +++ mplayer-1.0_rc2_p25993/stream/tv.h	2008-03-13 09:19:22.000000000  
>> +0300
>> @@ -119,6 +119,7 @@
>>     int index;
>>     char number[5];
>>     char name[20];
>> +	int norm;
>
> Spaces/tabs
>
>>     int   freq;
>>     struct tv_channels_s *next;
>>     struct tv_channels_s *prev;
>
> The rest looks ok for me.
>
> Please, also fix the man page to reflect new feature (fix can be in
> the same patch, English only is enough).
>

Fix all wrong alignment, and fix english man page.


-- 
С уважением Ильдар.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mplayer-1.0_rc2_p25993.norm.patch
Type: application/octet-stream
Size: 4852 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20080613/1d4ee8e9/attachment.obj>


More information about the MPlayer-dev-eng mailing list