Ejemplo n.º 1
0
 public ActionResult ReadAjax(StreamType streamType, long id, ShowReadEntries showReadEntries = ShowReadEntries.Hide)
 {
     var entries = this.rssSubscriptionService
         .LoadAllUnreadRssEntriesToReadForCurrentUserFromSubscription(streamType, id, showReadEntries);
     var result = this.Json(entries, JsonRequestBehavior.AllowGet);
     return result;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets an activity stream asynchronously.
        /// </summary>
        /// <param name="activityId">The Strava activity id.</param>
        /// <param name="typeFlags">Specifies the type of stream.</param>
        /// <param name="resolution">Specifies the resolution of the stream.</param>
        /// <returns>The stream data.</returns>
        public async Task<List<ActivityStream>> GetActivityStreamAsync(String activityId, StreamType typeFlags, StreamResolution resolution = StreamResolution.All)
        {
            StringBuilder types = new StringBuilder();

            foreach (StreamType type in (StreamType[])Enum.GetValues(typeof(StreamType)))
            {
                if (typeFlags.HasFlag(type))
                {
                    types.Append(type.ToString().ToLower());
                    types.Append(",");
                }
            }

            types.Remove(types.ToString().Length - 1, 1);

            String getUrl = String.Format("{0}/{1}/streams/{2}?{3}&access_token={4}",
                Endpoints.Activity,
                activityId,
                types,
                resolution != StreamResolution.All ? "resolution=" + resolution.ToString().ToLower() : "",
                Authentication.AccessToken
                );

            String json = await WebRequest.SendGetAsync(new Uri(getUrl));

            return Unmarshaller<List<ActivityStream>>.Unmarshal(json);
        }
Ejemplo n.º 3
0
		private StreamInfo (int streamIndex, StreamType st, String streamName, Dictionary<String, String> attributeDictionary) {
			m_streamIndex = streamIndex;
			m_streamType = st;
			m_language = null;
			m_streamName = streamName;
			m_attributeDictionary = attributeDictionary;
		}
Ejemplo n.º 4
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    public MiStreamRecord (StreamType streamType, string stream)
      : base ()
    {
      Type = streamType;

      Stream = stream;
    }
Ejemplo n.º 5
0
 public Stream(int HabboId, int AchievedItemId, Object AchievedItem, StreamType StreamType)
 {
     this.HabboId = HabboId;
     this.AchievedItemId = AchievedItemId;
     this.AchievedItem = AchievedItem;
     this.StreamType = StreamType;
 }
Ejemplo n.º 6
0
        public LogFile(string filename, StreamType streams = StreamType.All, ScriptBlock errorCallback = null)
        {
            fileName = System.IO.Path.GetFileName(filename);
            path = System.IO.Path.GetDirectoryName(filename);

            Streams = streams;
            ErrorCallback = errorCallback;
        }
Ejemplo n.º 7
0
        public bool IsStreamEnabled( StreamType stream )
        {
            IntPtr error = IntPtr.Zero;
            var value = NativeMethod.Device.rs_is_stream_enabled( device, stream, out error );
            RealSenseException.Handle( error );

            return value != 0;
        }
Ejemplo n.º 8
0
        public int GetStreamWidth( StreamType stream )
        {
            IntPtr error = IntPtr.Zero;
            var value = NativeMethod.Device.rs_get_stream_width( device, stream, out error );
            RealSenseException.Handle( error );

            return value;
        }
Ejemplo n.º 9
0
        public FormatType GetStreamFormat( StreamType stream )
        {
            IntPtr error = IntPtr.Zero;
            var value = NativeMethod.Device.rs_get_stream_format( device, stream, out error );
            RealSenseException.Handle( error );

            return value;
        }
        /*----------------------------------------------------------------
        ** Constructor
         * 
         * Parameters:  templatePath - the template to be loaded
         *              streamType - the document format of the template
         *              dataSource - new fields for the remapping
        **--------------------------------------------------------------*/
        public FieldRemappingDialog(string templatePath, StreamType streamType, DataSet dataSource)
        {
            InitializeComponent();

            m_template = templatePath;
            m_datasource = dataSource;
            templateStreamType = streamType;
        }
Ejemplo n.º 11
0
 //
 // Readable stream constructor
 //
 public StreamWrapper(int size, BasicStream s)
 {
     type_ = StreamType.Read;
     s_ = s;
     spos_ = 0;
     bytes_ = null;
     pos_ = 0;
     length_ = size;
 }
Ejemplo n.º 12
0
 //
 // Writeable stream constructor
 //
 public StreamWrapper(BasicStream s)
 {
     type_ = StreamType.Write;
     s_ = s;
     spos_ = s.pos();
     bytes_ = new byte[254];
     pos_ = 0;
     length_ = 0;
 }
 public HekaDAQOutputStream(string name, StreamType streamType, ushort channelNumber, HekaDAQController controller)
     : base(name, controller)
 {
     this.ChannelType = streamType;
     this.ChannelNumber = channelNumber;
     this.MeasurementConversionTarget = (ChannelType == StreamType.DO_PORT || ChannelType == StreamType.XO)
         ? Measurement.UNITLESS : DAQCountUnits;
     this.Controller = controller;
     this.Clock = controller.Clock;
 }
Ejemplo n.º 14
0
 public HekaDAQInputStream(string name, StreamType streamType, ushort channelNumber, HekaDAQController controller)
     : base(name, controller)
 {
     this.ChannelType = streamType;
     this.ChannelNumber = channelNumber;
     this.MeasurementConversionTarget = (ChannelType == StreamType.DIGITAL_IN || ChannelType == StreamType.AUX_IN)
         ? Measurement.UNITLESS : "V";
     this.Controller = controller;
     this.Clock = controller;
 }
Ejemplo n.º 15
0
 /** 
     @brief Get the stream index number
     @param[in] StreamType	The stream type
     @return The stream index numebr.
 **/
 public static Int32 StreamTypeToIndex(StreamType type)
 {
     Int32 s = 0;
     while ((Int32)type > 1)
     {
         type = (StreamType)((Int32)type >> 1);
         s++;
     }
     return s;
 }
Ejemplo n.º 16
0
 public FeatureRequest(
     long userId,
     long rssEntryId,
     StreamType modelStreamType,
     FeatureRequestType featureRequestType)
 {
     this.UserId = userId;
     this.RssEntryId = rssEntryId;
     this.StreamType = modelStreamType;
     this.Type = featureRequestType;
 }
Ejemplo n.º 17
0
 public string Play(string id, StreamType type = StreamType.Live)
 {
     if (_contents.ContainsKey(id))
         return type == StreamType.Live ? GenContentUrlHls(id) : GenContentUrl(id);
     int max = 0;
     if (_contents.Count > 0)
         max = _contents.Max(c => c.Value);
     max++;
     _contents.Add(id, max);
     return type == StreamType.Live ? GenContentUrlHls(id) : GenContentUrl(id);
 }
Ejemplo n.º 18
0
        public Stream GetStream(StreamType streamType, StreamParameters streamParameters)
        {
            LoadStreamFactories();

            if (_streamFactoriesHash.ContainsKey(streamType))
            {
                return _streamFactoriesHash[streamType].Create(streamParameters);
            }

            throw new ArgumentException(string.Format("No Factory defined for type {0}", streamType));
        }
Ejemplo n.º 19
0
        public override void ProcessLine(string line, StreamType stream)
        {
            if (Regex.IsMatch(line, @"^[0-9]{1,3}\.[0-9]{1}%", RegexOptions.Compiled))
            {
                su.PercentageDoneExact = getPercentage(line);
            }
            else
                base.ProcessLine(line, stream);

            lastLine = line;
        }
Ejemplo n.º 20
0
 /** 
     @brief Get the stream type string representation
     @param[in] type		The stream type
     @return The corresponding string representation.
 **/
 public static String StreamTypeToString(StreamType stream)
 {
     switch (stream)
     {
         case StreamType.STREAM_TYPE_COLOR: return "Color";
         case StreamType.STREAM_TYPE_DEPTH: return "Depth";
         case StreamType.STREAM_TYPE_IR: return "IR";
         case StreamType.STREAM_TYPE_LEFT: return "Left";
         case StreamType.STREAM_TYPE_RIGHT: return "Right";
     }
     return "Unknown";
 }
Ejemplo n.º 21
0
        private void AddStreamInfo(TrackEntrySection trackEntry, StreamType type, int index)
        {
            ClusterSection.TrackInfo trackInfo = null;
            try {
                trackInfo = MFI.Segment.Cluster.Tracks[(int)trackEntry.TrackNumber.Value].TrackInfo;
            } catch(Exception) { }

            Add(type, index, EntryKey.Index, () => index.ToString(), null);
            Add(type, index, EntryKey.TrackNumber, () => trackEntry.TrackNumber.Value.ToString(), null);
            Add(type, index, EntryKey.Size, () => trackInfo.TrackSize.ToString(), "byte");
            Add(type, index, EntryKey.Bitrate, () => trackInfo.AverageBitrate.HasValue ? trackInfo.AverageBitrate.Value.ToString("0", CultureInfo.InvariantCulture) : null, "bit/s");
            Add(type, index, EntryKey.Duration, () => trackInfo.TrackLength.TotalSeconds.ToString(CultureInfo.InvariantCulture), "s");
            Add(type, index, EntryKey.Title, () => trackEntry.Name, null);
            Add(type, index, EntryKey.Language, () => trackEntry.Language, null);
            Add(type, index, EntryKey.CodecName, () => trackEntry.CodecName, null);
            Add(type, index, EntryKey.CodecId, () => trackEntry.CodecId, null);

            if(trackEntry.GetBitMapInfoHeader().HasValue && string.Equals(trackEntry.CodecId, "V_MS/VFW/FOURCC")) {
                var header = trackEntry.GetBitMapInfoHeader().Value;
                Add(type, index, EntryKey.FourCC, () => header.FourCC, null);
                //Add(type, index, EntryKey.ColorBitDepth, () => header.biBitCount.ToString(), null);
            }
            Add(type, index, EntryKey.TwoCC, () => string.Equals(trackEntry.CodecId, "A_MS/ACM") && trackEntry.GetWaveFormatEx().HasValue ? trackEntry.GetWaveFormatEx().Value.TwoCC : null, null);
            Add(type, index, EntryKey.Id, () => trackEntry.TrackUId.ToString(), null);

            switch(type) {
                case StreamType.Video:
                    Add(type, index, EntryKey.FrameCount, () => trackInfo.LaceCount.ToString(), null);
                    Add(type, index, EntryKey.FrameRate, () => (trackEntry.DefaultDuration.HasValue ? 1000000000d / trackEntry.DefaultDuration.Value : 0).ToString("0.000", CultureInfo.InvariantCulture), "fps");

                    //if(trackInfo.MinLaceRate + 2 < trackInfo.MaxLaceRate) {
                    if(trackInfo.AverageLaceRate.HasValue) Add(type, index, EntryKey.VFR, () => trackInfo.AverageLaceRate.Value.ToString("0.000", CultureInfo.InvariantCulture), "fps");
                    if(trackInfo.MinLaceRate.HasValue) Add(type, index, EntryKey.MinFrameRate, () => trackInfo.MinLaceRate.Value.ToString("0.000", CultureInfo.InvariantCulture), "fps");
                    if(trackInfo.MaxLaceRate.HasValue) Add(type, index, EntryKey.MaxFrameRate, () => trackInfo.MaxLaceRate.Value.ToString("0.000", CultureInfo.InvariantCulture), "fps");
                    //}

                    Add(type, index, EntryKey.Width, () => trackEntry.Video.PixelWidth.ToString(), "px");
                    Add(type, index, EntryKey.Height, () => trackEntry.Video.PixelHeight.ToString(), "px");
                    Add(type, index, EntryKey.DAR, () => (trackEntry.Video.DisplayWidth / (double)trackEntry.Video.DisplayHeight).ToString("0.000", CultureInfo.InvariantCulture), null);
                    //Add(type, index, EntryKey.ColorSpace, () => Encoding.ASCII.GetString(trackEntry.Video.ColorSpace), null);
                    break;
                case StreamType.Audio:
                    Add(type, index, EntryKey.SampleCount, () => ((int)(trackInfo.TrackLength.TotalSeconds * trackEntry.Audio.SamplingFrequency)).ToString(), null);
                    Add(type, index, EntryKey.SamplingRate, () => trackEntry.Audio.SamplingFrequency.ToString(CultureInfo.InvariantCulture), null);
                    Add(type, index, EntryKey.ChannelCount, () => trackEntry.Audio.ChannelCount.ToString(), null);
                    break;
                case StreamType.Text: break;
            }
        }
        public void When_Loading_Unread_Entries_Must_Call_To_Factory_For_Proper_Handler(StreamType streamType)
        {
            // assert
            this.mockHandlerFactory
                .Setup(s => s.GetProvider(It.IsAny<StreamType>()))
                .Returns(this.mockSubscriptionHandler.Object);

            // act
            this.sut.LoadAllUnreadRssEntriesToReadForCurrentUserFromSubscription(streamType, 1, ShowReadEntries.Show);

            // assert
            this.mockHandlerFactory
                .Verify(v => v.GetProvider(It.IsAny<StreamType>()),
                Times.Once);
        }
        public void When_Provider_Is_Provided_Must_Pass_Parameters_To_Provider(StreamType streamType)
        {
            // assert
            this.mockHandlerFactory
                .Setup(s => s.GetProvider(It.IsAny<StreamType>()))
                .Returns(this.mockSubscriptionHandler.Object);

            // act
            this.sut.LoadAllUnreadRssEntriesToReadForCurrentUserFromSubscription(streamType, 1, ShowReadEntries.Show);

            // assert
            this.mockSubscriptionHandler
                .Verify(v => v.GetSubscriptionViewModel(It.IsAny<long>(), It.IsAny<ShowReadEntries>()),
                Times.Once);
        }
Ejemplo n.º 24
0
 private static FilterStreamInfos GetStreamInfos(StreamType type, int id, int streamsCount, FilterStreamInfos[] streams)
 {
   var empty = new FilterStreamInfos();
   for (int i = 0; i < streamsCount; i++)
   {
     if (type == streams[i].Type)
     {
       if (id == 0)
       {
         return streams[i];
       }
       id--;
     }
   }
   return empty;
 }
Ejemplo n.º 25
0
 //***************************************************************************
 // Class Constructors
 // 
 protected internal CDFDirectoryStream(int dId, string dirName, byte[] uniqueId, DateTime created, DateTime modified, StreamType type, NodeColor clr, int strmSid, int leftChild, int rightChild, int rootNode, long strmSize)
 {
     this.dId = dId;
     this.dirName = dirName;
     this.uniqueId = uniqueId;
     this.created = created;
     this.modified = modified;
     this.created = created;
     this.modified = modified;
     this.dirType = type;
     this.dirColor = clr;
     this.leftChild = leftChild;
     this.rightChild = rightChild;
     this.rootNode = rootNode;
     this.streamSid = strmSid;
     this.streamSize = strmSize;
 }
Ejemplo n.º 26
0
        BitmapSource CreateBitmapSource( Device device, StreamType stream )
        {
            var width = device.GetStreamWidth( stream );
            var height = device.GetStreamHeight( stream );
            var format = device.GetStreamFormat( stream );

            var pixelFormat = PixelFormats.Rgb24;
            if ( format == FormatType.y8 ) {
                pixelFormat = PixelFormats.Gray8;
            }
            else if ( format == FormatType.z16 ) {
                pixelFormat = PixelFormats.Gray16;
            }

            var bpp = pixelFormat.BitsPerPixel / 8;

            return BitmapSource.Create( width, height, 96, 96, pixelFormat, null,
                device.GetFrameData( stream ), width * height * bpp, width * bpp );
        }
Ejemplo n.º 27
0
        public short GetPrimairStreamIndexer(StreamType StreamType)
        {
            if (StreamType.Equals(StreamType.AchievedAchievement))
            {
                return 2;
            }
            else if (StreamType.Equals(StreamType.EditedMotto))
            {
                return 3;
            }
            else if (StreamType.Equals(StreamType.RatedRoom))
            {
                return 1;
            }
            else if (StreamType.Equals(StreamType.MadeFriends))
            {
                return 0;
            }

            return -1;
        }
Ejemplo n.º 28
0
        private void AddStreamInfo(Track track, StreamType type, int index)
        {
            Add(type, index, EntryKey.Index, () => index.ToString(), null);
            Add(type, index, EntryKey.Id, () => track.Id.ToString(), null);
            Add(type, index, EntryKey.Size, () => track.Length.ToString(), "byte");
            Add(type, index, EntryKey.Bitrate, () => track.Bitrate.HasValue? track.Bitrate.Value.ToString("0", CultureInfo.InvariantCulture) : null, "bit/s");
            Add(type, index, EntryKey.Duration, () => track.Duration.HasValue ? track.Duration.Value.TotalSeconds.ToString(CultureInfo.InvariantCulture) : null, "s");

            if(track.Comments != null) {
                if(track.Comments.Comments.Contains("title")) Add(type, index, EntryKey.Title, () => track.Comments.Comments["title"].Value.Aggregate((acc, str) => acc + "," + str), null);
                if(track.Comments.Comments.Contains("language")) Add(type, index, EntryKey.Language, () => track.Comments.Comments["language"].Value.Aggregate((acc, str) => acc + "," + str), null);
            }

            Add(type, index, EntryKey.CodecId, () => track.CodecName /*+ (track.CodecVersion != null ? " " + track.CodecVersion : "")*/, null);

            switch(type) {
                case StreamType.Video: var vTrack = (VideoTrack)track;
                    Add(type, index, EntryKey.FourCC, () => vTrack.FourCC, null);
                    Add(type, index, EntryKey.FrameCount, () => vTrack.FrameCount.ToString(), null);
                    Add(type, index, EntryKey.FrameRate, () => vTrack.FrameRate.ToString("0.000", CultureInfo.InvariantCulture), "fps");
                    Add(type, index, EntryKey.Width, () => vTrack.Width.ToString(), "px");
                    Add(type, index, EntryKey.Height, () => vTrack.Height.ToString(), "px");

                    if(vTrack.PAR.HasValue) {
                        var dar = (vTrack.Width * vTrack.PAR) / (double)vTrack.Height;
                        Add(type, index, EntryKey.DAR, () => dar.ToString(), null); //TODO: Actually PAR
                    }
                    break;
                case StreamType.Audio: var aTrack = (AudioTrack)track;
                    Add(type, index, EntryKey.SampleCount, () => aTrack.SampleCount.ToString(), null);
                    Add(type, index, EntryKey.SamplingRate, () => aTrack.SampleRate.ToString(CultureInfo.InvariantCulture), null);
                    Add(type, index, EntryKey.ChannelCount, () => aTrack.ChannelCount.ToString(), null);
                    break;
                case StreamType.Text: break;
            }
        }
        public YoutubeVideoStreamedItem(NameValueCollection info, String name) 
            : base(info["url"], name, MediaItemState.LOADED)
        {
            /*foreach (string v in info)
            {
                System.Diagnostics.Debug.Print(v + ": " + info[v]);
            }*/

            VideoMetadata videoMetadata = new VideoMetadata();
                                
            videoMetadata.MimeType = info["type"];
            if (videoMetadata.MimeType != null)
            {
                int pos = videoMetadata.MimeType.IndexOf(';');

                if (pos != -1)
                {
                    videoMetadata.MimeType = videoMetadata.MimeType.Substring(0, pos);
                }

            }
            //FallbackHost = info["fallback_host"];

            string fpsString = info["fps"];
            if (fpsString != null)
            {
                videoMetadata.FramesPerSecond = int.Parse(fpsString);
            }

            int iTag;

            bool success = int.TryParse(info["itag"], out iTag);

            if (success && itagFormatInfo.ContainsKey(iTag))
            {
                StreamFormatInfo formatInfo = itagFormatInfo[iTag];

                if (formatInfo.Width.HasValue && formatInfo.Height.HasValue)
                {
                    videoMetadata.Width = formatInfo.Width.Value;
                    videoMetadata.Height = formatInfo.Height.Value;
                }

                videoMetadata.SamplesPerSecond = formatInfo.AudioBitrate;

                StreamType = formatInfo.StreamType;               
            }
            else
            {
                StreamType = StreamType.UNKNOWN;
                
                if (success)
                {
                    Logger.Log.Error("Unknown itag in videostreaminfo: " + iTag);
#if DEBUG
                    throw new Exception("Unknown itag in videostreaminfo: " + iTag);
#endif
                }

            }

            Metadata = videoMetadata;
        }
 public StreamFormatInfo(StreamType streamType, int? width = null, int? height = null, int? audioBitrate = null)
 {
     Width = width;
     Height = height;
     StreamType = streamType;
     AudioBitrate = audioBitrate;
 }