Ejemplo n.º 1
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>");
        }
Ejemplo n.º 2
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>");
            }
        }