// This header file is automatically generated at build-time
// *** OFFICIAL RELEASE INFO -- Will not auto update
-#define PV2WAY_ENGINE_SDKINFO_LABEL "1022083"
+#define PV2WAY_ENGINE_SDKINFO_LABEL "1022110"
#define PV2WAY_ENGINE_SDKINFO_DATE 0x20091015
#endif //PV_2WAY_SDKINFO_H_INCLUDED
// This header file is automatically generated at build-time
// *** OFFICIAL RELEASE INFO -- Will not auto update
-#define PVAUTHOR_ENGINE_SDKINFO_LABEL "1022083"
+#define PVAUTHOR_ENGINE_SDKINFO_LABEL "1022110"
#define PVAUTHOR_ENGINE_SDKINFO_DATE 0x20091015
#endif //PV_AUTHOR_SDKINFO_H_INCLUDED
// This header file is automatically generated at build-time
// *** OFFICIAL RELEASE INFO -- Will not auto update
-#define PVPLAYER_ENGINE_SDKINFO_LABEL "1022083"
+#define PVPLAYER_ENGINE_SDKINFO_LABEL "1022110"
#define PVPLAYER_ENGINE_SDKINFO_DATE 0x20091015
#endif //PV_PLAYER_SDKINFO_H_INCLUDED
//b1 is set - Meta data is upfront, this implies temp files are needed while authoring
//b2 - undefined
//b3 is set - Do not use temp files while authoring
-//b4-b31 - Reserved for future use
+//b6 is set - Movie fragment mode
+//b7 is set - Live movie fragment mode
+//b8-b31 - Reserved for future use
/**
* This mode authors non Progressive Downloadable output files using temp files
// 6th bit is now reserved movie fragment mode and last bit is reserved for interleaving
#define PVMP4FF_MOVIE_FRAGMENT_MODE 0x00000021
+// live movie fragment mode
+// For authoring open-ended sessions for live streaming
+#define PVMP4FF_LIVE_MOVIE_FRAGMENT_MODE 0x00000061
+
#define DEFAULT_MOVIE_FRAGMENT_DURATION_IN_MS 10000
class PVMP4FFComposerSampleParam
virtual void setTargetBitrate(uint32 trackID, uint32 avgBitRate, uint32 maxBitRate = 0, uint32 bufferSizeDB = 0) = 0;
virtual void setTimeScale(uint32 trackID, uint32 rate) = 0;
virtual void setMaxBufferSizeDB(uint32 trackID, uint32 max) = 0;
+ virtual bool setTrackDuration(uint32 trackID, uint64 duration) = 0;
virtual void setMajorBrand(uint32 brand = BRAND_3GPP4) = 0;
virtual void setMajorBrandVersion(uint32 version = VERSION_3GPP4) = 0;
// parameter is ignored - hence the default parameter value.
PVA_FF_MediaAtom(int32 mediaType,
int32 codecType,
+ uint8 version,
uint32 fileAuthoringFlags,
uint32 protocol = 0,
uint8 profile = 1,
{
public:
- PVA_FF_MediaHeaderAtom(); // Constructor
+ PVA_FF_MediaHeaderAtom(uint8 version); // Constructor
virtual ~PVA_FF_MediaHeaderAtom();
// Creation Time gets and sets
- void setCreationTime(uint32 ct)
+ void setCreationTime(uint64 ct)
{
_creationTime = ct;
}
- uint32 getCreationTime() const
+ uint64 getCreationTime() const
{
return _creationTime;
}
}
// Duration gets and sets
- void setDuration(uint32 d)
+ void setDuration(uint64 d)
{
_duration = d;
}
- uint32 getDuration() const
+ uint64 getDuration() const
{
return _duration;
}
void init();
virtual void recomputeSize();
- uint32 _creationTime; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now
- uint32 _modificationTime; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now
+ uint64 _creationTime; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now
+ uint64 _modificationTime; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now
uint32 _timeScale; // 4 (32bits)
- uint32 _duration; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now
+ uint64 _duration; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now
uint16 _language; // Actually 3 5-bit objects representing the packed ISO-639-2/T language code
// Rendered as 15 bits with the leading pad bit from above.
virtual ~PVA_FF_MovieAtom();
// Get the duration of the movie
- uint32 getDuration()
+ uint64 getDuration()
{
return _pmovieHeaderAtom->getDuration();
}
}
// Movie Fragment : add movie extend atom usage APIs
- void setMovieFragmentDuration();
+ void setMovieFragmentDuration(uint32 movieFragmentDuration);
void updateMovieFragmentDuration(uint32 trackID, uint32 ts);
void writeMovieFragmentDuration(MP4_AUTHOR_FF_FILE_IO_WRAP* fp);
void SetMaxSampleSize(uint32, uint32);
// Movie Fragment : Atoms needed in movie fragment mode
PVA_FF_MovieExtendsAtom *_pMovieExtendsAtom;
bool _oMovieFragmentEnabled;
+ bool _oLiveMovieFragmentEnabled;
};
virtual ~PVA_FF_MovieHeaderAtom();
// Creation Time gets and sets - may not need to have the set method public!
- void setCreationTime(uint32 ct)
+ void setCreationTime(uint64 ct)
{
_creationTime = ct;
}
- uint32 getCreationTime() const
+ uint64 getCreationTime() const
{
return _creationTime;
}
}
// Duration gets and sets
- void setDuration(uint32 d)
+ void setDuration(uint64 d)
{
if (d > _duration)
{
}
}
- uint32 getDuration() const
+ uint64 getDuration() const
{
return _duration;
}
private:
- uint32 _creationTime; // 4/8 (32/64bits) -- Will templatize later - using 32bits (version 0) for now
- uint32 _modificationTime; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now
+ uint64 _creationTime; // 4/8 (32/64bits) -- Will templatize later - using 32bits (version 0) for now
+ uint64 _modificationTime; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now
uint32 _timeScale; // 4 (32bits)
- uint32 _duration; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now
+ uint64 _duration; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now
uint32 _nextTrackID; // 4 (32 bits)
void addTrackReference(uint32 currtrackID, int32 reftrackID);
void setTargetBitrate(uint32 trackID, uint32 avgBitRate, uint32 maxBitRate = 0, uint32 bufferSizeDB = 0);
void setTimeScale(uint32 trackID, uint32 rate);
+ bool setTrackDuration(uint32 trackID, uint64 duration);
// An access function to set the output path string for PVA_FF_MediaDataAtom objects
virtual void SetTempOutputPath(PVA_FF_UNICODE_STRING_PARAM outputPath);
uint32 _fileAuthoringFlags;
bool _oInterLeaveEnabled;
bool _oMovieAtomUpfront;
+ bool _oLiveMovieFragmentEnabled;
uint32 _interLeaveDuration; // Always in milliseconds
// parameter is ignored - hence the default parameter value.
PVA_FF_TrackAtom(int32 type,
uint32 id,
+ uint8 version,
uint32 fileAuthoringFlags,
int32 codecType = 0,
uint32 protocol = 0,
_pmediaAtom->setLanguage(language);
}
- uint32 getDuration() const
+ uint64 getDuration() const
{
return _ptrackHeader->getDuration();
}
}
// Creation Time gets and sets
- void setCreationTime(uint32 ct)
+ void setCreationTime(uint64 ct)
{
_creationTime = ct;
}
- uint32 getCreationTime() const
+ uint64 getCreationTime() const
{
return _creationTime;
}
// Modification Time gets and sets
- void setModificationTime(uint32 mt)
+ void setModificationTime(uint64 mt)
{
_modificationTime = mt;
}
- uint32 getModificationTime() const
+ uint64 getModificationTime() const
{
return _modificationTime;
}
}
// Duration gets and sets
- void setDuration(uint32 d)
+ void setDuration(uint64 d)
{
_duration = d;
}
- uint32 getDuration() const
+ uint64 getDuration() const
{
- uint32 total_duration = 0;
+ uint64 total_duration = 0;
total_duration = (_duration + _deltaTS);
- if (!total_duration)
+ if (total_duration == 0)
total_duration = _currTrackDuration;
return total_duration;
int32 _mediaType;
- uint32 _creationTime; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now
- uint32 _modificationTime; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now
+ uint64 _creationTime; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now
+ uint64 _modificationTime; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now
uint32 _trackID; // 4 (32bits)
uint32 _reserved1; // = 0;
- uint32 _duration; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now
+ uint64 _duration; // 4/8 (32/64bits) -- Will templatize later - using 32bits for now
// Static reserved constants
uint32 _reserved2[3]; // = { 0, 0, 0 };
// Constructor
PVA_FF_MediaAtom::PVA_FF_MediaAtom(int32 mediaType,
int32 codecType,
+ uint8 version,
uint32 fileAuthoringFlags,
uint32 protocol,
uint8 profile,
: PVA_FF_Atom(MEDIA_ATOM)
{
- PV_MP4_FF_NEW(fp->auditCB, PVA_FF_MediaHeaderAtom, (), _pmediaHeader);
+ PV_MP4_FF_NEW(fp->auditCB, PVA_FF_MediaHeaderAtom, (version), _pmediaHeader);
PV_MP4_FF_NEW(fp->auditCB, PVA_FF_HandlerAtom, (mediaType, (uint8)0, (uint8)0), _phandler);
#include "mediaheaderatom.h"
#include "atomutils.h"
#include "a_atomdefs.h"
+#include "oscl_int64_utils.h"
+
// Constructor
-PVA_FF_MediaHeaderAtom::PVA_FF_MediaHeaderAtom()
- : PVA_FF_FullAtom(MEDIA_HEADER_ATOM, 0, 0)
+PVA_FF_MediaHeaderAtom::PVA_FF_MediaHeaderAtom(uint8 version)
+ : PVA_FF_FullAtom(MEDIA_HEADER_ATOM, version, 0)
{
init(); // Initialize all member variables
recomputeSize();
void
PVA_FF_MediaHeaderAtom::init()
{
- PVA_FF_AtomUtils::setTime(_creationTime); // Setting creating time (since 1/1/1970) - NEED FIX to 1/1/1904
- PVA_FF_AtomUtils::setTime(_modificationTime); // Setting modification time
+ // use a temporary variable to set the current time since the API setTime takes uint32 parameters
+ uint32 timeSet;
+ PVA_FF_AtomUtils::setTime(timeSet); // Setting creating time (since 1/1/1970) - NEED FIX to 1/1/1904
+ _creationTime = timeSet;
+ PVA_FF_AtomUtils::setTime(timeSet); // Setting modification time
+ _modificationTime = timeSet;
_timeScale = DEFAULT_PRESENTATION_TIMESCALE;
_duration = 0;
_language = 0; // Until find better default value
PVA_FF_MediaHeaderAtom::recomputeSize()
{
int32 size = getDefaultSize(); // Get size of base class members
- size += 4; // creationTime
- size += 4; // modificationTime
- size += 4; // timeScale
- size += 4; // duration
+
+ // Fields that vary depending on the version
+ if (getVersion() == 0)
+ {
+ size += 4; //_creationTime
+ size += 4; //_modificationTime
+ size += 4; //_timeScale
+ size += 4; //_duration
+ }
+ else // getVersion() == 1
+ {
+ size += 8; //_creationTime
+ size += 8; //_modificationTime
+ size += 4; //_timeScale
+ size += 8; //_duration
+ }
size += 2; // language
size += 2; // reserved
}
rendered += getDefaultSize();
- if (!PVA_FF_AtomUtils::render32(fp, getCreationTime()))
+ if (getVersion() == 0)
{
- return false;
+ if (!PVA_FF_AtomUtils::render32(fp,
+ Oscl_Int64_Utils::get_uint64_lower32(getCreationTime())))
+ {
+ return false;
+ }
+
+ if (!PVA_FF_AtomUtils::render32(fp,
+ Oscl_Int64_Utils::get_uint64_lower32(getModificationTime())))
+
+ {
+ return false;
+ }
}
- if (!PVA_FF_AtomUtils::render32(fp, getModificationTime()))
+ else // getVersion() == 1
{
- return false;
+ if (!PVA_FF_AtomUtils::render64(fp, getCreationTime()))
+ {
+ return false;
+ }
+ if (!PVA_FF_AtomUtils::render64(fp, getModificationTime()))
+ {
+ return false;
+ }
}
+
if (!PVA_FF_AtomUtils::render32(fp, getTimeScale()))
{
return false;
* To ensure that the total track duration includes the duration of the
* last sample as well, which in our case fp same as the last but one.
*/
- uint32 totalDuration = getDuration() + _deltaTS;
+ uint64 totalDuration = getDuration() + _deltaTS;
- if (!PVA_FF_AtomUtils::render32(fp, totalDuration))
+ if (getVersion() == 0)
{
- return false;
+ if (!PVA_FF_AtomUtils::render32(fp,
+ Oscl_Int64_Utils::get_uint64_lower32(totalDuration)))
+ {
+ return false;
+ }
+ }
+ else // getVersion() == 1
+ {
+ if (!PVA_FF_AtomUtils::render64(fp, totalDuration))
+ {
+ return false;
+ }
+ }
+
+ if (getVersion() == 0)
+ {
+ rendered += 16;
+ }
+ else
+ {
+ rendered += 28;
}
- rendered += 16;
if (!PVA_FF_AtomUtils::render16(fp, getLanguage()))
{
_pAssetInfoKeyRecordingYearAtom = NULL;
_oMovieFragmentEnabled = false;
+ _pMovieExtendsAtom = NULL;
//Movie Fragment : Enable movie fragment mode and create movie extends atom
if ((fileAuthoringFlags & PVMP4FF_MOVIE_FRAGMENT_MODE) == (PVMP4FF_MOVIE_FRAGMENT_MODE))
{
}
- PV_MP4_FF_NEW(fp->auditCB, PVA_FF_MovieHeaderAtom, ((uint8)0, (uint32)0, fileAuthoringFlags), _pmovieHeaderAtom);
+ _oLiveMovieFragmentEnabled = false;
+ // Live movie fragment mode
+ // Note, this mode implies PVMP4FF_MOVIE_FRAGMENT_MODE, so both _oMovieFragmentEnabled and
+ // _oLiveMovieFragmentEnabled will be set to true
+ if ((fileAuthoringFlags & PVMP4FF_LIVE_MOVIE_FRAGMENT_MODE) == PVMP4FF_LIVE_MOVIE_FRAGMENT_MODE)
+ {
+ _oLiveMovieFragmentEnabled = true;
+ }
+
+ // Use version 1 of the FullBox spec only when PVMP4FF_LIVE_MOVIE_FRAGMENT_MODE is enabled
+ uint8 movieHeaderVersion = 0;
+ if (_oLiveMovieFragmentEnabled)
+ movieHeaderVersion = 1;
+ PV_MP4_FF_NEW(fp->auditCB, PVA_FF_MovieHeaderAtom, (movieHeaderVersion, (uint32)0, fileAuthoringFlags), _pmovieHeaderAtom);
PV_MP4_FF_NEW(fp->auditCB, PVA_FF_TrackAtomVecType, (), _pMediaTrackVec);
if (_puserDataAtom != NULL)
{
- if (_puserDataAtom->getUserDataAtomVecSize() > 0)
+
+ if ((_puserDataAtom->getUserDataAtomVecSize() > 0)
+ && !(_oLiveMovieFragmentEnabled))
{
size += _puserDataAtom->getSize();
}
{
for (uint32 i = 0; i < _pMediaTrackVec->size(); i++)
{
- if ((*_pMediaTrackVec)[i]->getSampleCount() > 0)
+ if (((*_pMediaTrackVec)[i]->getSampleCount() > 0)
+ || (_oLiveMovieFragmentEnabled))
{
size += (*_pMediaTrackVec)[i]->getSize();
}
void
PVA_FF_MovieAtom::prepareToRender()
{
- uint32 maxTrackDuration = 0;
+ uint64 maxTrackDuration = 0;
- uint32 creationTime = _pmovieHeaderAtom->getCreationTime();
- uint32 modTime = _pmovieHeaderAtom->getModificationTime();
+ uint64 creationTime = _pmovieHeaderAtom->getCreationTime();
+ uint64 modTime = _pmovieHeaderAtom->getModificationTime();
if (_pMediaTrackVec != NULL)
{
track->prepareToRender();
- uint32 TrackDuration = track->getDuration();
+ uint64 TrackDuration = track->getDuration();
if (TrackDuration > maxTrackDuration)
{
{
if (_puserDataAtom != NULL)
{
- if (_puserDataAtom->getUserDataAtomVecSize() > 0)
+ // Don't render user data atoms when the live movie
+ // fragment mode is enabled
+ if ((_puserDataAtom->getUserDataAtomVecSize() > 0)
+ && !(_oLiveMovieFragmentEnabled))
{
if (!_puserDataAtom->renderToFileStream(fp))
{
{
for (uint32 i = 0; i < _pMediaTrackVec->size(); i++)
{
- if ((*_pMediaTrackVec)[i]->getSampleCount() > 0)
+ // Render track information when there are samples available
+ // or the mode PVMP4FF_LIVE_MOVIE_FRAGMENT_MODE is enabled
+ if (((*_pMediaTrackVec)[i]->getSampleCount() > 0)
+ || (_oLiveMovieFragmentEnabled))
{
if (!((*_pMediaTrackVec)[i]->renderToFileStream(fp)))
{
// functions to set and update fragment duration in MVEX atom
void
-PVA_FF_MovieAtom::setMovieFragmentDuration()
+PVA_FF_MovieAtom::setMovieFragmentDuration(uint32 movieFragmentDuration)
{
+ if (_pMovieExtendsAtom != NULL)
+ {
+ // fragment duration is specified in milliseconds. Convert it to
+ // the presentation timescale
+ uint32 movieFragmentDur = (uint32)(((float)(movieFragmentDuration) * getTimeScale()) / 1000);
+ _pMovieExtendsAtom->setMovieFragmentDuration(movieFragmentDur);
- _pMovieExtendsAtom->setMovieFragmentDuration(getDuration());
-
+ }
}
#include "movieheaderatom.h"
#include "atomutils.h"
#include "a_atomdefs.h"
+#include "oscl_int64_utils.h"
// Constructor
{
OSCL_UNUSED_ARG(fileAuthoringFlags);
- PVA_FF_AtomUtils::setTime(_creationTime); // Setting creating time (since 1/1/1904)
- PVA_FF_AtomUtils::setTime(_modificationTime); // Setting modification time
+ // use a temporary variable to set the current time since the API setTime takes uint32 parameters
+ uint32 timeSet;
+ PVA_FF_AtomUtils::setTime(timeSet); // Setting creating time (since 1/1/1904)
+ _creationTime = timeSet;
+ PVA_FF_AtomUtils::setTime(timeSet); // Setting modification time
+ _modificationTime = timeSet;
_timeScale = DEFAULT_PRESENTATION_TIMESCALE;
_duration = 0;
_nextTrackID = INITIAL_TRACK_ID;
PVA_FF_MovieHeaderAtom::recomputeSize()
{
int32 size = getDefaultSize(); // Default size of PVA_FF_FullAtom class
- size += sizeof(_creationTime); // Sizes of member variables
- size += sizeof(_modificationTime);
- size += sizeof(_timeScale);
- size += sizeof(_duration);
+
+ // Fields that vary depending on the version
+ if (getVersion() == 0)
+ {
+ size += 4; //_creationTime
+ size += 4; //_modificationTime
+ size += 4; //_timeScale
+ size += 4; //_duration
+ }
+ else // getVersion() == 1
+ {
+ size += 8; //_creationTime
+ size += 8; //_modificationTime
+ size += 4; //_timeScale
+ size += 8; //_duration
+ }
size += 76; // Size of combined reserved words
}
rendered += getDefaultSize();
- if (!PVA_FF_AtomUtils::render32(fp, getCreationTime()))
+ if (getVersion() == 0)
{
- return false;
+ if (!PVA_FF_AtomUtils::render32(fp,
+ Oscl_Int64_Utils::get_uint64_lower32(getCreationTime())))
+ {
+ return false;
+ }
+
+ if (!PVA_FF_AtomUtils::render32(fp,
+ Oscl_Int64_Utils::get_uint64_lower32(getModificationTime())))
+
+ {
+ return false;
+ }
}
- if (!PVA_FF_AtomUtils::render32(fp, getModificationTime()))
+ else // getVersion() == 1
{
- return false;
+ if (!PVA_FF_AtomUtils::render64(fp, getCreationTime()))
+ {
+ return false;
+ }
+ if (!PVA_FF_AtomUtils::render64(fp, getModificationTime()))
+ {
+ return false;
+ }
}
+
+
if (!PVA_FF_AtomUtils::render32(fp, getTimeScale()))
{
return false;
* last sample as well, which in our case fp same as the last but one.
*/
//uint32 totalDuration = getDuration() + _deltaTS;
- uint32 totalDuration = getDuration();
- if (!PVA_FF_AtomUtils::render32(fp, totalDuration))
+ uint64 totalDuration = getDuration();
+
+ if (getVersion() == 0)
{
- return false;
+ if (!PVA_FF_AtomUtils::render32(fp,
+ Oscl_Int64_Utils::get_uint64_lower32(totalDuration)))
+ {
+ return false;
+ }
+ }
+ else // getVersion() == 1
+ {
+ if (!PVA_FF_AtomUtils::render64(fp, totalDuration))
+ {
+ return false;
+ }
+ }
+
+ if (getVersion() == 0)
+ {
+ rendered += 16;
+ }
+ else
+ {
+ rendered += 28;
}
- rendered += 16;
uint32 reserved = 0x00010000;
if (!PVA_FF_AtomUtils::render32(fp, reserved))
_oIsFileOpen = false;
_pInterLeaveBufferVec = NULL;
_oInterLeaveEnabled = false;
+ _oLiveMovieFragmentEnabled = false;
_aFs = NULL;
}
// Movie Fragments flags initialised
_oMovieFragmentEnabled = false;
+ _oLiveMovieFragmentEnabled = false;
_oComposeMoofAtom = false;
_movieFragmentDuration = DEFAULT_MOVIE_FRAGMENT_DURATION_IN_MS;
_pCurrentMoofAtom = NULL;
_oUserDataUpFront = false;
}
+ // Live movie fragment mode
+ // Note, this mode implies PVMP4FF_MOVIE_FRAGMENT_MODE, so both _oMovieFragmentEnabled and
+ // _oLiveMovieFragmentEnabled will be set to true
+ if ((fileAuthoringFlags & PVMP4FF_LIVE_MOVIE_FRAGMENT_MODE) == PVMP4FF_LIVE_MOVIE_FRAGMENT_MODE)
+ {
+ _oLiveMovieFragmentEnabled = true;
+ }
+
// Create user data atom
PV_MP4_FF_NEW(fp->auditCB, PVA_FF_UserDataAtom, (), _puserDataAtom);
mda = getMediaDataAtomForTrack(0);
}
+ // For track creation, use version 1 of FullBox spec when _oLiveMovieFragmentEnabled is true
+ uint8 fbVersion = 0;
+ if (_oLiveMovieFragmentEnabled)
+ fbVersion = 1;
+
+
if ((uint32) mediaType == MEDIA_TYPE_AUDIO)
{
// Create default audio track and add it to moov atom
PV_MP4_FF_NEW(fp->auditCB, PVA_FF_TrackAtom, (MEDIA_TYPE_AUDIO,
_pmovieAtom->getMutableMovieHeaderAtom().findNextTrackID(),
+ fbVersion,
_fileAuthoringFlags,
codecType,
1, profile, profileComp, level),
// Create default video track and add it to moov atom
PV_MP4_FF_NEW(fp->auditCB, PVA_FF_TrackAtom, (MEDIA_TYPE_VISUAL,
_pmovieAtom->getMutableMovieHeaderAtom().findNextTrackID(),
+ fbVersion,
_fileAuthoringFlags,
codecType,
1, profile, profileComp, level),
// Create default video track and add it to moov atom
PV_MP4_FF_NEW(fp->auditCB, PVA_FF_TrackAtom, (MEDIA_TYPE_TEXT,
_pmovieAtom->getMutableMovieHeaderAtom().findNextTrackID(),
+ fbVersion,
_fileAuthoringFlags,
codecType,
1,
return;
}
+bool
+PVA_FF_Mpeg4File::setTrackDuration(uint32 trackID, uint64 duration)
+{
+ PVA_FF_TrackAtom *mediaTrack = _pmovieAtom->getMediaTrack(trackID);
+ if (mediaTrack == NULL)
+ return false;
+
+ // Track duration can only be set for mode PVMP4FF_LIVE_MOVIE_FRAGMENT_MODE
+ if (_oLiveMovieFragmentEnabled == false)
+ return false;
+
+ PVA_FF_TrackHeaderAtom *ptkhdr = mediaTrack->getTrackHeaderAtomPtr();
+ ptkhdr->setDuration(duration);
+
+ return true;
+}
+
//this will work same as the addsampletotrack but this
//will be called only for timed text file format
bool PVA_FF_Mpeg4File::addTextSampleToTrack(uint32 trackID, PVMP4FFComposerSampleParam *pSampleParam)
PVA_FF_Mpeg4File::setMovieFragmentDuration(uint32 duration)
{
_movieFragmentDuration = duration;
+ _pmovieAtom->setMovieFragmentDuration(duration);
return;
}
_pCurrentMoofAtom = pMoofAtom;
// set Movie fragment duration
- _pmovieAtom->setMovieFragmentDuration();
+ _pmovieAtom->setMovieFragmentDuration(_movieFragmentDuration);
// add track fragments
for (uint32 kk = 0; kk < _pmediaDataAtomVec->size(); kk++)
// Constructor
PVA_FF_TrackAtom::PVA_FF_TrackAtom(int32 type,
uint32 id,
+ uint8 version,
uint32 fileAuthoringFlags,
int32 codecType,
uint32 protocol,
_setDecoderSpecificInfoDone = true;
}
- PV_MP4_FF_NEW(fp->auditCB, PVA_FF_TrackHeaderAtom, (type, id, (uint8)0, (uint32)0x000001, fileAuthoringFlags), _ptrackHeader);
+ PV_MP4_FF_NEW(fp->auditCB, PVA_FF_TrackHeaderAtom, (type, id, version, (uint32)0x000001, fileAuthoringFlags), _ptrackHeader);
PV_MP4_FF_NEW(fp->auditCB, PVA_FF_MediaAtom, (type,
codecType,
+ version,
fileAuthoringFlags,
protocol, profile,
profileComp, level),
{
int32 rendered = 0; // Keep track of number of bytes rendered
- uint32 creationTime = _ptrackHeader->getCreationTime();
- uint32 modTime = _ptrackHeader->getModificationTime();
+ uint64 creationTime = _ptrackHeader->getCreationTime();
+ uint64 modTime = _ptrackHeader->getModificationTime();
PVA_FF_MediaHeaderAtom *mdhdPtr = _pmediaAtom->getMediaHeaderAtomPtr();
mdhdPtr->setCreationTime(creationTime);
mdhdPtr->setModificationTime(modTime);
+ mdhdPtr->setDuration(getDuration());
recomputeSize();
#include "trackheaderatom.h"
#include "atomutils.h"
#include "a_atomdefs.h"
+#include "oscl_int64_utils.h"
+
#define TIMED_TEXT_WIDTH 176
#define TIMED_TEXT_HEIGHT 177
void
PVA_FF_TrackHeaderAtom::init(int32 type)
{
- PVA_FF_AtomUtils::setTime(_creationTime);
- PVA_FF_AtomUtils::setTime(_modificationTime);
+ // use a temporary variable to set the current time since the API setTime takes uint32 parameters
+ uint32 timeSet;
+ PVA_FF_AtomUtils::setTime(timeSet);
+ _creationTime = timeSet;
+ PVA_FF_AtomUtils::setTime(timeSet);
+ _modificationTime = timeSet;
setTimeScale(0);
_duration = 0;
PVA_FF_TrackHeaderAtom::recomputeSize()
{
int32 size = getDefaultSize(); // From base class
- size += 4; // _creationTime;
- size += 4; // _modificationTime
+
+ // Fields that vary depending on the version
+ if (getVersion() == 0)
+ {
+ size += 4; //_creationTime
+ size += 4; //_modificationTime
+ size += 4; //_duration
+ }
+ else // getVersion() == 1
+ {
+ size += 8; //_creationTime
+ size += 8; //_modificationTime
+ size += 8; //_duration
+ }
+
size += 4; // _trackID;
size += 4; // _reserved1
- size += 4; // _duration;
size += 60; // rest of reserved words
_size = size;
}
rendered += getDefaultSize();
- if (!PVA_FF_AtomUtils::render32(fp, getCreationTime()))
+ if (getVersion() == 0)
{
- return false;
+ if (!PVA_FF_AtomUtils::render32(fp,
+ Oscl_Int64_Utils::get_uint64_lower32(getCreationTime())))
+ {
+ return false;
+ }
+
+ if (!PVA_FF_AtomUtils::render32(fp,
+ Oscl_Int64_Utils::get_uint64_lower32(getModificationTime())))
+
+ {
+ return false;
+ }
}
- if (!PVA_FF_AtomUtils::render32(fp, getModificationTime()))
+ else // getVersion() == 1
{
- return false;
+ if (!PVA_FF_AtomUtils::render64(fp, getCreationTime()))
+ {
+ return false;
+ }
+ if (!PVA_FF_AtomUtils::render64(fp, getModificationTime()))
+ {
+ return false;
+ }
}
trackID = getTrackID();
{
return false;
}
- rendered += 12;
+
+
+ if (getVersion() == 0)
+ {
+ rendered += 12;
+ }
+ else
+ {
+ rendered += 20;
+ }
if (!PVA_FF_AtomUtils::render32(fp, _reserved1))
{
* last sample as well, which in our case is same as the last but one.
*/
- uint32 totalDuration = getDuration();
+ uint64 totalDuration = getDuration();
- if (!totalDuration)
+ if (totalDuration == 0)
{
totalDuration = _currTrackDuration;
}
- if (!PVA_FF_AtomUtils::render32(fp, totalDuration))
+ if (getVersion() == 0)
{
- return false;
+ if (!PVA_FF_AtomUtils::render32(fp,
+ Oscl_Int64_Utils::get_uint64_lower32(totalDuration)))
+ {
+ return false;
+ }
+
+ rendered += 4;
+ }
+ else // getVersion() == 1
+ {
+ if (!PVA_FF_AtomUtils::render64(fp, totalDuration))
+ {
+ return false;
+ }
+
+ rendered += 8;
}
- rendered += 4;
if (!PVA_FF_AtomUtils::render32(fp, _reserved2[0]))
{