Revision 6f1fe643

View differences:

chunker_player/player_core.c
325 325
	char audio_stats[255], video_stats[255];
326 326
	sprintf(audio_stats, "waiting for incoming audio packets...");
327 327
	sprintf(video_stats, "waiting for incoming video packets...");
328
	ChunkerPlayerGUI_SetStatsText(audio_stats, video_stats);
328
	ChunkerPlayerGUI_SetStatsText(audio_stats, video_stats,LED_GREEN);
329 329
	
330 330
	return 0;
331 331
}
......
1443 1443
			}
1444 1444
			else
1445 1445
				sprintf(video_stats_text, "waiting for incoming video packets...");
1446
			
1447
			if(qoe)
1448
			    ChunkerPlayerGUI_SetStatsText(audio_stats_text, video_stats_text,(qoe>LED_THRS_YELLOW?LED_GREEN:((qoe<=LED_THRS_YELLOW && qoe>LED_THRS_RED)?LED_YELLOW:LED_RED)));
1449
			else
1450
			    ChunkerPlayerGUI_SetStatsText(audio_stats_text, video_stats_text,LED_GREEN);
1451
			
1446 1452

  
1447
			ChunkerPlayerGUI_SetStatsText(audio_stats_text, video_stats_text);
1448 1453
			last_stats_evaluation = now;
1449 1454
		}
1450 1455
		
chunker_player/player_defines.h
22 22
#define NOFULLSCREEN_HOVER_ICON_FILE "icons/nofullscreen32.png"
23 23
#define AUDIO_ON_ICON_FILE "icons/audio_on.png"
24 24
#define AUDIO_OFF_ICON_FILE "icons/audio_off.png"
25
#define PSNR_LED_RED_ICON_FILE "icons/red_led.png"
26
#define PSNR_LED_YELLOW_ICON_FILE "icons/yellow_led.png"
27
#define PSNR_LED_GREEN_ICON_FILE "icons/green_led.png"
25 28

  
26 29
#define CHANNEL_UP_ICON_FILE "icons/up_16.png"
27 30
#define CHANNEL_DOWN_ICON_FILE "icons/down_16.png"
......
45 48
#define CHANNEL_DOWN_BUTTON_INDEX 3
46 49
#define AUDIO_OFF_BUTTON_INDEX 4
47 50
#define AUDIO_ON_BUTTON_INDEX 5
51
#define PSNR_LED_RED_BUTTON_INDEX 6
52
#define PSNR_LED_YELLOW_BUTTON_INDEX 7
53
#define PSNR_LED_GREEN_BUTTON_INDEX 8
48 54

  
49
#define NBUTTONS 6
55
#define LED_RED     0
56
#define LED_YELLOW  1
57
#define LED_GREEN   2
58

  
59
#define LED_THRS_RED    33.0f
60
#define LED_THRS_YELLOW 36.0f
61

  
62
#define NBUTTONS 9
50 63
#define MAIN_FONT_FILE "mainfont.ttf"
51 64
#define MAIN_FONT_SIZE 18
52 65

  
......
77 90
//#define DEBUG_QUEUE
78 91
//#define DEBUG_QUEUE_DEEP
79 92
//#define DEBUG_SOURCE
80
#define DEBUG_STATS
81
#define DEBUG_STATS_DEEP
93
//#define DEBUG_STATS
94
//#define DEBUG_STATS_DEEP
82 95
//#define DEBUG_AUDIO_BUFFER
83 96
//#define DEBUG_CHUNKER
84
#define EMULATE_CHUNK_LOSS
97
//#define EMULATE_CHUNK_LOSS
85 98

  
86 99
#define VIDEO_DEINTERLACE
87 100

  
chunker_player/player_gui.c
18 18
void RedrawStats();
19 19
void SetupGUI();
20 20
void ToggleAudio();
21
void PSNRLedCallback();
21 22

  
22 23
static char AudioStatsText[255];
23 24
static char VideoStatsText[255];
......
196 197
			&& ( y > Buttons[i].ButtonIconBox.y ) && ( y < Buttons[i].ButtonIconBox.y + Buttons[i].ButtonIcon->h )
197 198
		)
198 199
		{
200
		    // LED Button 
201
		    if(i>=PSNR_LED_RED_BUTTON_INDEX && i<=PSNR_LED_GREEN_BUTTON_INDEX)
202
		    {
203
		        SDL_SetCursor(defaultCursor);
204
		        break;
205
		    }
206
		        
199 207
			Buttons[i].Hover = 1;
200 208
			SDL_SetCursor(handCursor);
201 209
			break;
......
231 239

  
232 240
void ChunkerPlayerGUI_HandleKey()
233 241
{
234
	static Uint32 LastTime=0;
242
	/*static Uint32 LastTime=0;
235 243
	static int LastKey=-1;
236 244

  
237 245
	Uint32 Now=SDL_GetTicks();
......
242 250
		LastKey=SDLK_ESCAPE;
243 251
		LastTime=Now;
244 252
		quit=1;
245
	}
253
	}*/
246 254
}
247 255

  
248 256
void ChunkerPlayerGUI_Close()
......
637 645
	Buttons[AUDIO_ON_BUTTON_INDEX].ButtonIcon = SDL_DisplayFormatAlpha(temp);
638 646
	Buttons[AUDIO_ON_BUTTON_INDEX].ButtonHoverIcon = SDL_DisplayFormatAlpha(temp);
639 647
	SDL_FreeSurface(temp);
648
	
649
	// PSNR RED LED
650
	temp = IMG_Load(PSNR_LED_RED_ICON_FILE);
651
	if (temp == NULL) {
652
		fprintf(stderr, "Error loading %s: %s\n", PSNR_LED_RED_ICON_FILE, SDL_GetError());
653
		exit(1);
654
	}
655
	Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonIcon = SDL_DisplayFormatAlpha(temp);
656
	Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonHoverIcon = SDL_DisplayFormatAlpha(temp);
657
	SDL_FreeSurface(temp);
658
	
659
	// PSNR YELLOW LED
660
	temp = IMG_Load(PSNR_LED_YELLOW_ICON_FILE);
661
	if (temp == NULL) {
662
		fprintf(stderr, "Error loading %s: %s\n", PSNR_LED_YELLOW_ICON_FILE, SDL_GetError());
663
		exit(1);
664
	}
665
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonIcon = SDL_DisplayFormatAlpha(temp);
666
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonHoverIcon = SDL_DisplayFormatAlpha(temp);
667
	SDL_FreeSurface(temp);
668
	
669
	// PSNR GREEN LED
670
	temp = IMG_Load(PSNR_LED_GREEN_ICON_FILE);
671
	if (temp == NULL) {
672
		fprintf(stderr, "Error loading %s: %s\n", PSNR_LED_GREEN_ICON_FILE, SDL_GetError());
673
		exit(1);
674
	}
675
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonIcon = SDL_DisplayFormatAlpha(temp);
676
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonHoverIcon = SDL_DisplayFormatAlpha(temp);
677
	SDL_FreeSurface(temp);
640 678

  
641 679
	/** Setting up icon boxes */
642 680
	Buttons[FULLSCREEN_BUTTON_INDEX].XOffset = Buttons[NO_FULLSCREEN_BUTTON_INDEX].XOffset = 20;
......
675 713
	Buttons[AUDIO_ON_BUTTON_INDEX].ButtonIconBox.y = screen_h - Buttons[AUDIO_ON_BUTTON_INDEX].ButtonIconBox.h - (SCREEN_BOTTOM_PADDING/2);
676 714
	Buttons[AUDIO_ON_BUTTON_INDEX].Visible = 0;
677 715
	
716
	Buttons[PSNR_LED_RED_BUTTON_INDEX].XOffset = -106;
717
	Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonIconBox.w = Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonIcon->w;
718
	Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonIconBox.h = Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonIcon->h;
719
	Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonIconBox.x = (screen_w + Buttons[PSNR_LED_RED_BUTTON_INDEX].XOffset);
720
	Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonIconBox.y = screen_h - Buttons[PSNR_LED_RED_BUTTON_INDEX].ButtonIconBox.h - (SCREEN_BOTTOM_PADDING/2);
721
	Buttons[PSNR_LED_RED_BUTTON_INDEX].Visible = 0;
722
	
723
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].XOffset = -106;
724
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonIconBox.w = Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonIcon->w;
725
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonIconBox.h = Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonIcon->h;
726
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonIconBox.x = (screen_w + Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].XOffset);
727
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonIconBox.y = screen_h - Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].ButtonIconBox.h - (SCREEN_BOTTOM_PADDING/2);
728
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].Visible = 0;
729
	
730
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].XOffset = -106;
731
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonIconBox.w = Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonIcon->w;
732
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonIconBox.h = Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonIcon->h;
733
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonIconBox.x = (screen_w + Buttons[PSNR_LED_GREEN_BUTTON_INDEX].XOffset);
734
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonIconBox.y = screen_h - Buttons[PSNR_LED_GREEN_BUTTON_INDEX].ButtonIconBox.h - (SCREEN_BOTTOM_PADDING/2);
735
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].Visible = 1;
736
	
678 737
	// Setting up buttons events
679 738
	Buttons[FULLSCREEN_BUTTON_INDEX].ToggledButton = &(Buttons[NO_FULLSCREEN_BUTTON_INDEX]);
680 739
	Buttons[FULLSCREEN_BUTTON_INDEX].LButtonUpCallback = &ChunkerPlayerGUI_ToggleFullscreen;
......
683 742
	Buttons[CHANNEL_DOWN_BUTTON_INDEX].LButtonUpCallback = &ZapDown;
684 743
	Buttons[AUDIO_OFF_BUTTON_INDEX].LButtonUpCallback = &ToggleAudio;
685 744
	Buttons[AUDIO_ON_BUTTON_INDEX].LButtonUpCallback = &ToggleAudio;
745
	Buttons[PSNR_LED_RED_BUTTON_INDEX].LButtonUpCallback = &PSNRLedCallback;
746
	Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].LButtonUpCallback = &PSNRLedCallback;
747
	Buttons[PSNR_LED_GREEN_BUTTON_INDEX].LButtonUpCallback = &PSNRLedCallback;
686 748
}
687 749

  
688 750
void ChunkerPlayerGUI_SetChannelTitle(char* title)
......
705 767
	RedrawChannelName();
706 768
}
707 769

  
708
void ChunkerPlayerGUI_SetStatsText(char* audio_text, char* video_text)
770
void ChunkerPlayerGUI_SetStatsText(char* audio_text, char* video_text, int ledstatus)
709 771
{
710 772
	if(SilentMode)
711 773
		return;
......
725 787
	strcpy(AudioStatsText, audio_text);
726 788
	strcpy(VideoStatsText, video_text);
727 789
	
790
	switch(ledstatus)
791
    {
792
    case LED_RED:
793
        // PSNR LED RED
794
        Buttons[PSNR_LED_RED_BUTTON_INDEX].Visible = 1;
795
		Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].Visible = 0;
796
		Buttons[PSNR_LED_GREEN_BUTTON_INDEX].Visible = 0;
797
	    break;
798
	case LED_YELLOW:
799
	    // PSNR LED YELLOW
800
	    Buttons[PSNR_LED_RED_BUTTON_INDEX].Visible = 0;
801
		Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].Visible = 1;
802
		Buttons[PSNR_LED_GREEN_BUTTON_INDEX].Visible = 0;
803
	    break;
804
	case LED_GREEN:
805
	    // PSNR LED GREEN
806
	    Buttons[PSNR_LED_RED_BUTTON_INDEX].Visible = 0;
807
		Buttons[PSNR_LED_YELLOW_BUTTON_INDEX].Visible = 0;
808
		Buttons[PSNR_LED_GREEN_BUTTON_INDEX].Visible = 1;
809
	    break;
810
	}
811
	
728 812
	RedrawStats();
813
	RedrawButtons();
729 814
}
730 815

  
731 816
void RedrawStats()
......
819 904
	RedrawButtons();
820 905
}
821 906

  
907
void PSNRLedCallback()
908
{
909
}
910

  
822 911
void ChunkerPlayerGUI_ChannelSwitched()
823 912
{
824 913
	if(!Audio_ON)
chunker_player/player_gui.h
39 39
void ChunkerPlayerGUI_SetupOverlayRect(SChannel* channel);
40 40
void ChunkerPlayerGUI_ForceResize(int w, int h);
41 41
void ChunkerPlayerGUI_SetChannelTitle(char* title);
42
void ChunkerPlayerGUI_SetStatsText(char* audio_text, char* video_text);
42
void ChunkerPlayerGUI_SetStatsText(char* audio_text, char* video_text, int ledstatus);
43 43
void ChunkerPlayerGUI_ToggleFullscreen();
44 44
void ChunkerPlayerGUI_ChannelSwitched();
45 45
void GetScreenSizeFromOverlay(int overlayWidth, int overlayHeight, int* screenWidth, int* screenHeight);

Also available in: Unified diff