Esempio n. 1
0
 /// <summary>
 /// Constructor to use when reading.
 /// </summary>
 /// <param name="inPath">Path to folder where all ISM files are</param>
 /// <param name="ismFileName">The ISM main file name, with NO extension</param>
 public ISMFile(string inPath, string ismFileName) :
     this(new FileStream(Path.Combine(new string[] { inPath, ismFileName + ".ism" }), FileMode.Open, FileAccess.Read, FileShare.Read))
 {
     _baseName   = Path.Combine(new string[] { inPath, ismFileName });
     _baseFolder = inPath;
     _ismc       = new ISMCFile(inPath, ismFileName, _ismElements);
 }
Esempio n. 2
0
 /// <summary>
 /// Constructor to use when reading.
 /// </summary>
 /// <param name="inPath">Path to folder where all ISM files are</param>
 /// <param name="ismFileName">The ISM main file name, with NO extension</param>
 public ISMFile(string inPath, string ismFileName)
     : this(new FileStream(Path.Combine(new string[] {inPath, ismFileName + ".ism"}), FileMode.Open, FileAccess.Read, FileShare.Read))
 {
     _baseName = Path.Combine(new string[] { inPath, ismFileName });
       _baseFolder = inPath;
       _ismc = new ISMCFile(inPath, ismFileName, _ismElements);
 }
Esempio n. 3
0
        public void Write(TextWriter ISM, string inOrigISMCDir, string inName, ISMCFile ismc)
        {
            string tmpRate = _bitrate.ToString();
              tmpRate = tmpRate.Substring(0, tmpRate.Length - 3);

              if (_fragmentType == MP4.FragmentType.Video)
            ISM.WriteLine("      <video");
              else if (_fragmentType == MP4.FragmentType.Audio)
            ISM.WriteLine("      <audio");
              else return;

              ISM.WriteLine("        src=\"" + inName + "_" + tmpRate + ".ismv\"");
              ISM.WriteLine("        systemBitrate=\"" + _bitrate + "\">");
              if (ismc == null)
              {
            ISM.WriteLine("        <param");
            ISM.WriteLine("          name=\"trackID\"");
            ISM.WriteLine("          value=\"2\"");
            ISM.WriteLine("          valuetype=\"data\" />");
              }
              else
              {
            ISM.WriteLine("        <param");
            ISM.WriteLine("          name=\"trackID\"");
            ISM.WriteLine("          value=\"2\"");
            ISM.WriteLine("          valuetype=\"data\"");
            ISM.Write("          chunks=\"");

            //          Console.WriteLine("Video Bitrate: " + vid.systemBitrate);
            ISMVFile vfile = new ISMVFile(inOrigISMCDir, _source);

            string chunkData = "";
            int chunkId = 0;
            ulong currTime = 0;
            Fragment frag = new Fragment();
            foreach (c cidx in ismc.indexs[0].cs)
            {
              ulong ChunkStart = 0;
              ulong ChunkLen = 0;
              // need to fix this line            vfile.GetFragmentPosition(currTime, 2, out ChunkStart, out ChunkLen);

              currTime += ulong.Parse(cidx.d);
              chunkId++;

              //            Console.WriteLine(" ChunkStart: " + ChunkStart + " ChunkLen: " + ChunkLen);
              chunkData += ChunkStart + "-" + ChunkLen + ",";
              ISM.Write(chunkData);
            }
            ISM.WriteLine("\">");
            ChunkInfo[_bitrate.ToString()] = chunkData;
              }

              if (_fragmentType == MP4.FragmentType.Video)
            ISM.WriteLine("      </video>");
              else if (_fragmentType == MP4.FragmentType.Audio)
            ISM.WriteLine("      </audio>");
        }
Esempio n. 4
0
        public void Write(TextWriter ISM, string inOrigISMCDir, string inName, ISMCFile ismc)
        {
            string tmpRate = _bitrate.ToString();

            tmpRate = tmpRate.Substring(0, tmpRate.Length - 3);

            if (_fragmentType == MP4.FragmentType.Video)
            {
                ISM.WriteLine("      <video");
            }
            else if (_fragmentType == MP4.FragmentType.Audio)
            {
                ISM.WriteLine("      <audio");
            }
            else
            {
                return;
            }

            ISM.WriteLine("        src=\"" + inName + "_" + tmpRate + ".ismv\"");
            ISM.WriteLine("        systemBitrate=\"" + _bitrate + "\">");
            if (ismc == null)
            {
                ISM.WriteLine("        <param");
                ISM.WriteLine("          name=\"trackID\"");
                ISM.WriteLine("          value=\"2\"");
                ISM.WriteLine("          valuetype=\"data\" />");
            }
            else
            {
                ISM.WriteLine("        <param");
                ISM.WriteLine("          name=\"trackID\"");
                ISM.WriteLine("          value=\"2\"");
                ISM.WriteLine("          valuetype=\"data\"");
                ISM.Write("          chunks=\"");

                //          Console.WriteLine("Video Bitrate: " + vid.systemBitrate);
                ISMVFile vfile = new ISMVFile(inOrigISMCDir, _source);

                string   chunkData = "";
                int      chunkId   = 0;
                ulong    currTime  = 0;
                Fragment frag      = new Fragment();
                foreach (c cidx in ismc.indexs[0].cs)
                {
                    ulong ChunkStart = 0;
                    ulong ChunkLen   = 0;
                    // need to fix this line            vfile.GetFragmentPosition(currTime, 2, out ChunkStart, out ChunkLen);

                    currTime += ulong.Parse(cidx.d);
                    chunkId++;

                    //            Console.WriteLine(" ChunkStart: " + ChunkStart + " ChunkLen: " + ChunkLen);
                    chunkData += ChunkStart + "-" + ChunkLen + ",";
                    ISM.Write(chunkData);
                }
                ISM.WriteLine("\">");
                ChunkInfo[_bitrate.ToString()] = chunkData;
            }

            if (_fragmentType == MP4.FragmentType.Video)
            {
                ISM.WriteLine("      </video>");
            }
            else if (_fragmentType == MP4.FragmentType.Audio)
            {
                ISM.WriteLine("      </audio>");
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Constructor to use when writing to an ISM file.
 /// </summary>
 /// <param name="basePath">Path to folder plus base file name (no extension)</param>
 public ISMFile(string basePath)
 {
     _baseName   = basePath;
     _baseFolder = _baseName.Substring(0, _baseName.LastIndexOf(Path.DirectorySeparatorChar));
     _ismc       = new ISMCFile(_baseName);
 }
Esempio n. 6
0
 /// <summary>
 /// Constructor to use when writing to an ISM file.
 /// </summary>
 /// <param name="basePath">Path to folder plus base file name (no extension)</param>
 public ISMFile(string basePath)
 {
     _baseName = basePath;
       _baseFolder = _baseName.Substring(0, _baseName.LastIndexOf(Path.DirectorySeparatorChar));
       _ismc = new ISMCFile(_baseName);
 }