Commit 0c01d856 authored by Valentin Vetter's avatar Valentin Vetter Committed by Jean-Baptiste Kempf

DCP: Read multiple reels

Allow to read more than one reel
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 366a9aa8
This diff is collapsed.
......@@ -225,6 +225,10 @@ AssetMap::~AssetMap() { }
int AssetMap::Parse ( )
{
int type = 0;
int reel_nbr = 0;
int index = 0;
int sum_duration_vid = 0;
int sum_duration_aud = 0;
string node;
CPL *cpl;
......@@ -327,23 +331,53 @@ int AssetMap::Parse ( )
this->CloseXml();
return -1;
}
/*TODO : case of 1st reel only managed */
reel = cpl->getReel(0);
Asset *asset;
/* Get picture */
asset = reel->getTrack(TRACK_PICTURE);
msg_Dbg( this->p_demux, "Video Track: %s",asset->getPath().c_str());
msg_Dbg( this->p_demux, "Entry point: %i",asset->getEntryPoint());
p_dcp->videofile = p_dcp->path + asset->getPath();
p_dcp->i_video_entry = asset->getEntryPoint();
/* Get audio */
asset = reel->getTrack(TRACK_SOUND);
msg_Dbg( this->p_demux, "Audio Track: %s",asset->getPath().c_str());
msg_Dbg( this->p_demux, "Entry point: %i",asset->getEntryPoint());
p_dcp->audiofile = p_dcp->path + asset->getPath();
p_dcp->i_audio_entry = asset->getEntryPoint();
reel_nbr = cpl->getReelList().size();
for(index = 0; index != reel_nbr; ++index)
{
reel = cpl->getReel(index);
Asset *asset;
struct info_reel video;
struct info_reel audio;
/* Get picture */
asset = reel->getTrack(TRACK_PICTURE);
if (asset != NULL)
{
sum_duration_vid += asset->getDuration();
video.filename = p_dcp->path + asset->getPath();
video.i_entrypoint = asset->getEntryPoint();
video.i_duration = asset->getDuration();
video.i_correction = video.i_entrypoint - sum_duration_vid + video.i_duration;
video.i_absolute_end = sum_duration_vid;
p_dcp->video_reels.push_back(video);
msg_Dbg( this->p_demux, "Video Track: %s",asset->getPath().c_str());
msg_Dbg( this->p_demux, "Entry point: %i",asset->getEntryPoint());
}
/* Get audio */
asset = reel->getTrack(TRACK_SOUND);
if (asset != NULL)
{
/*if (!p_dcp->audio_reels.empty())
{
sum_duration_aud = 0;
for (int i = 0; i != p_dcp->audio_reels.size(); ++i)
{
sum_duration_aud += p_dcp->audio_reels(i).i_duration;
}
}*/
sum_duration_aud += asset->getDuration();
audio.filename = p_dcp->path + asset->getPath();
audio.i_entrypoint = asset->getEntryPoint();
audio.i_duration = asset->getDuration();
audio.i_correction = audio.i_entrypoint - sum_duration_aud + audio.i_duration;
audio.i_absolute_end = sum_duration_aud;
p_dcp->audio_reels.push_back(audio);
msg_Dbg( this->p_demux, "Audio Track: %s",asset->getPath().c_str());
msg_Dbg( this->p_demux, "Entry point: %i",asset->getEntryPoint());
}
}
/* free memory */
this->CloseXml();
return VLC_SUCCESS;
......
......@@ -63,6 +63,17 @@ class Asset;
class AssetList: public std::list<Asset *> {};
class PKL;
/* This struct stores useful information about an MXF for demux() */
struct info_reel
{
string filename;
int i_entrypoint;
int i_duration;
int i_correction; /* entrypoint - sum of previous durations */
int i_absolute_end; /* correction + duration */
};
/* This struct stores the most important information about the DCP */
struct dcp_t
{
......@@ -71,16 +82,11 @@ struct dcp_t
vector<PKL *> pkls;
AssetList *p_asset_list;
string videofile; /* Picture file name */
string audiofile; /* Sound file name */
int i_video_entry; /* Picture entry point */
int i_audio_entry; /* Sound entry point */
vector<info_reel> audio_reels;
vector<info_reel> video_reels;
dcp_t():
p_asset_list(NULL),
i_video_entry(0),
i_audio_entry(0) {};
p_asset_list(NULL) {};
~dcp_t( ) {
vlc_delete_all(pkls);
......@@ -160,6 +166,7 @@ public:
string getId() const { return this->s_id; } ;
string getPath() const { return this->s_path; };
string getType() const { return this->s_type; };
string getOriginalFilename() const { return this->s_original_filename; };
int getEntryPoint() const { return this->i_entry_point; };
int getDuration() const { return this->i_duration; };
int getIntrinsicDuration() const { return this->i_intrisic_duration; };
......@@ -236,6 +243,7 @@ public:
virtual int Parse();
Reel *getReel(int pos) { return this->vec_reel[pos]; } ;
std::vector<Reel *> getReelList() { return this->vec_reel; } ;
private :
AssetList *asset_list;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment