EbmlWriter.cpp revision 9eef83afd866975dc281176ba0bf2d891d9ab33a
/* $Id$ */
/** @file
* EbmlWriter.cpp - EBML writer + WebM container
*/
/*
* Copyright (C) 2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
* General Public License (GPL) as published by the Free Software
* Foundation, in version 2 as it comes in the "COPYING" file of the
* VirtualBox OSE distribution. VirtualBox OSE is distributed in the
* hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
*/
/*
* This code is based on:
*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "EbmlWriter.h"
{
}
{
}
{
return RTFileTell(m_File);
}
WebMWriter::WebMWriter() :
m_bDebug(false),
m_iLastPtsMs(-1),
m_Framerate(),
m_uSeekInfoPos(0),
m_uTrackPos(0),
m_uCuePos(0),
m_uClusterPos(0),
m_uTrackIdPos(0),
m_uStartSegment(0),
m_bClusterOpen(false) {}
{
if (RT_SUCCESS(rc))
{
}
return rc;
}
void WebMWriter::close()
{
}
{
a_Ebml.write<uint32_t>(0x10000000u | (Ebml::getSizeOfUInt(a_Data.trackNumber) + 2 + 1 + a_Data.dataSize));
return a_Ebml;
}
void WebMWriter::writeSeekInfo()
{
// Save the current file pointer
if (m_uSeekInfoPos)
else
char szVersion[64];
}
const struct vpx_rational *a_pFps)
{
try
{
m_Framerate = *a_pFps;
}
catch(int rc)
{
LogFlow(("WebMWriter::writeHeader catched"));
return rc;
}
return VINF_SUCCESS;
}
const vpx_codec_cx_pkt_t *a_pPkt)
{
try {
uint16_t uBlockTimecode = 0;
bool bStartCluster = false;
/* Calculate the PTS of this frame in milliseconds */
if (iPtsMs <= m_iLastPtsMs)
/* Calculate the relative time of this block */
bStartCluster = 1;
else
if (bStartCluster || fKeyframe)
{
if (m_bClusterOpen)
/* Open a new cluster */
uBlockTimecode = 0;
m_bClusterOpen = true;
/* Save a cue point if this is a keyframe. */
if (fKeyframe)
{
}
}
// Write a Simple Block
}
catch(int rc)
{
LogFlow(("WebMWriter::writeBlock catched"));
return rc;
}
return VINF_SUCCESS;
}
{
try {
if (m_bClusterOpen)
{
}
}
catch(int rc)
{
LogFlow(("WebMWriter::writeFooterException catched"));
return rc;
}
return VINF_SUCCESS;
}