//
//  FourStreamsViewController.h
//  MiAlerts
//
//  Created by Mahammad on 10/3/14.
//  Copyright (c) 2014 Mahammad. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>
#import "AVPlayerPlaybackView.h"
#import "MBProgressHUD.h"
#import "AppDelegate.h"


@interface FourStreamsViewController : UIViewController<MBProgressHUDDelegate,NSURLConnectionDelegate,NSStreamDelegate> {
  /*  UIImageView* mPlayer1;
    UIImageView* mPlayer2;
    UIImageView* mPlayer3;
    UIImageView* mPlayer4;*/
    IBOutlet UIImageView  *mCameraView1;
    IBOutlet UIImageView  *mCameraView2;
    IBOutlet UIImageView  *mCameraView3;
    IBOutlet UIImageView  *mCameraView4;
    
    UIBarButtonItem *btnPing, *btnInfo;
    
    long long timer_before_connect, timer_after_handshake, timer_after_successful_frame_received, frames_successful, frames_repeated, timer_after_connect_before_receive, bytes_read, bytes_error;
   MBProgressHUD *HUD;
   //
    
     IBOutlet UIActivityIndicatorView *   activityIndicator;

}

@property (nonatomic, assign ) long long timer_before_connect, timer_after_handshake, timer_after_successful_frame_received, frames_successful, timer_after_connect_before_receive,frames_repeated, bytes_read, bytes_error;

@property(nonatomic,retain)NSURLConnection *urlConnection;
@property(nonatomic,retain)NSMutableData *mutableData;

@property (nonatomic, assign, readonly ) BOOL               isSending;
@property (nonatomic, strong, readwrite) NSOutputStream *   networkStream;
@property (nonatomic, strong, readwrite) NSInputStream *    fileStream;
@property (nonatomic, assign, readonly ) uint8_t *          buffer;
@property (nonatomic, assign, readwrite) size_t             bufferOffset;
@property (nonatomic, assign, readwrite) size_t             bufferLimit;


@property (readwrite, retain) NSString *mux_cams_urls0,*mux_cams_urls1,*mux_cams_urls2,*mux_cams_urls3,*BBBKID;
@property (nonatomic, retain) NSString *cams;
@property (readwrite) BOOL bSockets;

@property (nonatomic, strong, readwrite) IBOutlet UIActivityIndicatorView *   activityIndicator;
@property (nonatomic, retain) IBOutlet UIImageView *mCameraView1;
@property (nonatomic, retain) IBOutlet UIImageView *mCameraView2;
@property (nonatomic, retain) IBOutlet UIImageView *mCameraView3;
@property (nonatomic, retain) IBOutlet UIImageView *mCameraView4;
@property (nonatomic, retain) UIBarButtonItem *btnPing, *btnInfo;

- (void)observeValueForKeyPath:(NSString*) path ofObject:(id)object change:(NSDictionary*)change context:(void*)context;

@end
