MediaSourceUtils.cpp (1192B)
1 /* -*- mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 #include "MediaSourceUtils.h" 7 8 #include "mozilla/Logging.h" 9 #include "nsPrintfCString.h" 10 11 namespace mozilla { 12 13 nsCString DumpTimeRanges(const media::TimeIntervals& aRanges) { 14 nsCString dump; 15 16 dump = "["; 17 18 for (uint32_t i = 0; i < aRanges.Length(); ++i) { 19 if (i > 0) { 20 dump += ", "; 21 } 22 dump += nsPrintfCString("(%f, %f)", aRanges.Start(i).ToSeconds(), 23 aRanges.End(i).ToSeconds()); 24 } 25 26 dump += "]"; 27 28 return dump; 29 } 30 31 nsCString DumpTimeRangesRaw(const media::TimeIntervals& aRanges) { 32 nsCString dump; 33 34 dump = "["; 35 36 for (uint32_t i = 0; i < aRanges.Length(); ++i) { 37 if (i > 0) { 38 dump += ", "; 39 } 40 dump += nsPrintfCString("(%s, %s)", aRanges.Start(i).ToString().get(), 41 aRanges.End(i).ToString().get()); 42 } 43 44 dump += "]"; 45 46 return dump; 47 } 48 49 } // namespace mozilla