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() { } ...@@ -225,6 +225,10 @@ AssetMap::~AssetMap() { }
int AssetMap::Parse ( ) int AssetMap::Parse ( )
{ {
int type = 0; int type = 0;
int reel_nbr = 0;
int index = 0;
int sum_duration_vid = 0;
int sum_duration_aud = 0;
string node; string node;
CPL *cpl; CPL *cpl;
...@@ -327,23 +331,53 @@ int AssetMap::Parse ( ) ...@@ -327,23 +331,53 @@ int AssetMap::Parse ( )
this->CloseXml(); this->CloseXml();
return -1; return -1;
} }
/*TODO : case of 1st reel only managed */
reel = cpl->getReel(0); reel_nbr = cpl->getReelList().size();
for(index = 0; index != reel_nbr; ++index)
{
reel = cpl->getReel(index);
Asset *asset; Asset *asset;
struct info_reel video;
struct info_reel audio;
/* Get picture */ /* Get picture */
asset = reel->getTrack(TRACK_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, "Video Track: %s",asset->getPath().c_str());
msg_Dbg( this->p_demux, "Entry point: %i",asset->getEntryPoint()); 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 */ /* Get audio */
asset = reel->getTrack(TRACK_SOUND); 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, "Audio Track: %s",asset->getPath().c_str());
msg_Dbg( this->p_demux, "Entry point: %i",asset->getEntryPoint()); 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(); }
/* free memory */ /* free memory */
this->CloseXml(); this->CloseXml();
return VLC_SUCCESS; return VLC_SUCCESS;
......
...@@ -63,6 +63,17 @@ class Asset; ...@@ -63,6 +63,17 @@ class Asset;
class AssetList: public std::list<Asset *> {}; class AssetList: public std::list<Asset *> {};
class PKL; 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 */ /* This struct stores the most important information about the DCP */
struct dcp_t struct dcp_t
{ {
...@@ -71,16 +82,11 @@ struct dcp_t ...@@ -71,16 +82,11 @@ struct dcp_t
vector<PKL *> pkls; vector<PKL *> pkls;
AssetList *p_asset_list; AssetList *p_asset_list;
string videofile; /* Picture file name */ vector<info_reel> audio_reels;
string audiofile; /* Sound file name */ vector<info_reel> video_reels;
int i_video_entry; /* Picture entry point */
int i_audio_entry; /* Sound entry point */
dcp_t(): dcp_t():
p_asset_list(NULL), p_asset_list(NULL) {};
i_video_entry(0),
i_audio_entry(0) {};
~dcp_t( ) { ~dcp_t( ) {
vlc_delete_all(pkls); vlc_delete_all(pkls);
...@@ -160,6 +166,7 @@ public: ...@@ -160,6 +166,7 @@ public:
string getId() const { return this->s_id; } ; string getId() const { return this->s_id; } ;
string getPath() const { return this->s_path; }; string getPath() const { return this->s_path; };
string getType() const { return this->s_type; }; string getType() const { return this->s_type; };
string getOriginalFilename() const { return this->s_original_filename; };
int getEntryPoint() const { return this->i_entry_point; }; int getEntryPoint() const { return this->i_entry_point; };
int getDuration() const { return this->i_duration; }; int getDuration() const { return this->i_duration; };
int getIntrinsicDuration() const { return this->i_intrisic_duration; }; int getIntrinsicDuration() const { return this->i_intrisic_duration; };
...@@ -236,6 +243,7 @@ public: ...@@ -236,6 +243,7 @@ public:
virtual int Parse(); virtual int Parse();
Reel *getReel(int pos) { return this->vec_reel[pos]; } ; Reel *getReel(int pos) { return this->vec_reel[pos]; } ;
std::vector<Reel *> getReelList() { return this->vec_reel; } ;
private : private :
AssetList *asset_list; 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