Compare commits

...

3 Commits

Author SHA1 Message Date
Robin Gareus b00ddcfe1c
Fix -Waddress (and expand tabs)
The expansion of the macro resulted in:
"the comparison will always evaluate as 'true' for the address of .."
2024-04-24 18:06:27 +02:00
agfline 8ea3a14cd6
Update AAF import UI 2024-04-24 17:13:00 +02:00
agfline 41587d3c06
Update libaaf to v1.0-11-gb04c547 2024-04-24 17:13:00 +02:00
17 changed files with 298 additions and 217 deletions

View File

@ -17,7 +17,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <fcntl.h> // O_WRONLY
#include <fcntl.h> // O_WRONLY
#include <glib/gstdio.h> // g_unlink()
#include "pbd/basename.h"
@ -50,26 +50,38 @@ using namespace ARDOUR;
static void
aaf_debug_callback (struct aafLog* log, void* ctxdata, int libid, int type, const char* srcfile, const char* srcfunc, int lineno, const char* msg, void* user)
{
const char *eol = "";
const char* eol = "";
if ( libid != LOG_SRC_ID_TRACE && libid != LOG_SRC_ID_DUMP ) {
switch ( type ) {
case VERB_SUCCESS: PBD::info << string_compose ("[libaaf] %1:%2 in %3(): ", srcfile, lineno, srcfunc); break;
case VERB_ERROR: PBD::error << string_compose ("[libaaf] %1:%2 in %3(): ", srcfile, lineno, srcfunc); break;
case VERB_WARNING: PBD::warning << string_compose ("[libaaf] %1:%2 in %3(): ", srcfile, lineno, srcfunc); break;
// case VERB_DEBUG: PBD::debug << string_compose ("[libaaf] %1:%2 in %3(): ", srcfile, lineno, srcfunc); break;
if (libid != LOG_SRC_ID_TRACE && libid != LOG_SRC_ID_DUMP) {
switch (type) {
case VERB_SUCCESS:
PBD::info << string_compose ("[libaaf] %1:%2 in %3(): ", srcfile, lineno, srcfunc);
break;
case VERB_ERROR:
PBD::error << string_compose ("[libaaf] %1:%2 in %3(): ", srcfile, lineno, srcfunc);
break;
case VERB_WARNING:
PBD::warning << string_compose ("[libaaf] %1:%2 in %3(): ", srcfile, lineno, srcfunc);
break;
// case VERB_DEBUG: PBD::debug << string_compose ("[libaaf] %1:%2 in %3(): ", srcfile, lineno, srcfunc); break;
}
}
if ( libid != LOG_SRC_ID_DUMP ) {
if (libid != LOG_SRC_ID_DUMP) {
eol = "\n";
}
switch ( type ) {
case VERB_SUCCESS: PBD::info << msg << eol; break;
case VERB_ERROR: PBD::error << msg << eol; break;
case VERB_WARNING: PBD::warning << msg << eol; break;
// case VERB_DEBUG: PBD::debug << msg << eol; break;
switch (type) {
case VERB_SUCCESS:
PBD::info << msg << eol;
break;
case VERB_ERROR:
PBD::error << msg << eol;
break;
case VERB_WARNING:
PBD::warning << msg << eol;
break;
// case VERB_DEBUG: PBD::debug << msg << eol; break;
}
LOG_BUFFER_RESET (log);
@ -121,84 +133,96 @@ prepare_audio_track (aafiAudioTrack* aafTrack, Session* s)
}
static bool
import_sndfile_as_region (Session* s, struct aafiAudioEssencePointer* aafAudioEssencePtrList, SrcQuality quality, timepos_t& pos, SourceList& sources, ImportStatus& status, vector<std::shared_ptr<Region>>& regions)
import_sndfile_as_region (Session* s, struct aafiAudioEssencePointer* aafAudioEssencePtrList, SrcQuality quality, timepos_t& pos, SourceList** oneClipSources, ImportStatus& status, vector<std::shared_ptr<Region>>& regions)
{
/* Import the source */
status.clear ();
SourceList* sources = NULL;
status.current = 1;
status.total = 1;
status.freeze = false;
status.quality = quality;
status.replace_existing_source = false;
status.split_midi_channels = false;
status.import_markers = false;
status.done = false;
status.cancel = false;
if (aafAudioEssencePtrList->user) {
sources = (SourceList*)aafAudioEssencePtrList->user;
} else {
sources = new SourceList;
int channelCount = 0;
/* Import the source */
status.clear ();
aafiAudioEssencePointer *aafAudioEssencePtr = NULL;
AAFI_foreachEssencePointer (aafAudioEssencePtrList, aafAudioEssencePtr) {
if ( aafAudioEssencePtr->essenceFile->usable_file_path )
status.paths.push_back (aafAudioEssencePtr->essenceFile->usable_file_path);
else
status.paths.push_back (aafAudioEssencePtr->essenceFile->original_file_path);
status.current = 1;
status.total = 1;
status.freeze = false;
status.quality = quality;
status.replace_existing_source = false;
status.split_midi_channels = false;
status.import_markers = false;
status.done = false;
status.cancel = false;
channelCount++;
PBD::info << string_compose ("AAF: Preparing to import clip channel %1: %2\n", channelCount, aafAudioEssencePtr->essenceFile->unique_name);
int channelCount = 0;
aafiAudioEssencePointer* aafAudioEssencePtr = NULL;
AAFI_foreachEssencePointer (aafAudioEssencePtrList, aafAudioEssencePtr)
{
if (aafAudioEssencePtr->essenceFile->usable_file_path)
status.paths.push_back (aafAudioEssencePtr->essenceFile->usable_file_path);
else
status.paths.push_back (aafAudioEssencePtr->essenceFile->original_file_path);
channelCount++;
PBD::info << string_compose ("AAF: Preparing to import clip channel %1: %2\n", channelCount, aafAudioEssencePtr->essenceFile->unique_name);
}
s->import_files (status);
status.progress = 1.0;
sources->clear ();
/* FIXME: There is no way to tell if cancel button was pressed
* or if the file failed to import, just that one of these occurred.
* We want status.cancel to reflect the user's choice only
*/
if (status.cancel && status.current > 1) {
/* Succeeded to import file, assume user hit cancel */
return false;
} else if (status.cancel && status.current == 1) {
/* Failed to import file, assume user did not hit cancel */
status.cancel = false;
return false;
}
for (int i = 0; i < channelCount; i++) {
sources->push_back (status.sources.at (i));
}
/* build peakfiles */
for (SourceList::iterator x = sources->begin (); x != sources->end (); ++x) {
SourceFactory::setup_peakfile (*x, true);
}
aafAudioEssencePtrList->user = sources;
}
s->import_files (status);
status.progress = 1.0;
sources.clear ();
/* FIXME: There is no way to tell if cancel button was pressed
* or if the file failed to import, just that one of these occurred.
* We want status.cancel to reflect the user's choice only
*/
if (status.cancel && status.current > 1) {
/* Succeeded to import file, assume user hit cancel */
return false;
} else if (status.cancel && status.current == 1) {
/* Failed to import file, assume user did not hit cancel */
status.cancel = false;
return false;
}
for (int i = 0; i < channelCount; i++) {
sources.push_back (status.sources.at (i));
}
/* build peakfiles */
for (SourceList::iterator x = sources.begin (); x != sources.end (); ++x) {
SourceFactory::setup_peakfile (*x, true);
}
*oneClipSources = sources;
/* Put the source on a region */
std::shared_ptr<Region> region;
string region_name;
/* take all the sources we have and package them up as a region */
region_name = region_name_from_path (status.paths.front (), (sources.size () > 1), false);
region_name = region_name_from_path (status.paths.front (), (sources->size () > 1), false);
/* we checked in import_sndfiles() that there were not too many */
while (RegionFactory::region_by_name (region_name)) {
region_name = bump_name_once (region_name, '.');
}
PropertyList proplist;
proplist.add (ARDOUR::Properties::start, 0);
proplist.add (ARDOUR::Properties::length, timecnt_t (sources[0]->length (), pos));
proplist.add (ARDOUR::Properties::length, timecnt_t ((*sources)[0]->length (), pos));
proplist.add (ARDOUR::Properties::name, aafAudioEssencePtrList->essenceFile->unique_name);
proplist.add (ARDOUR::Properties::layer, 0);
proplist.add (ARDOUR::Properties::whole_file, true);
proplist.add (ARDOUR::Properties::external, true);
region = RegionFactory::create (sources, proplist);
region = RegionFactory::create (*sources, proplist);
regions.push_back (region);
return true;
}
@ -302,14 +326,14 @@ set_region_fade (aafiAudioClip* aafAudioClip, std::shared_ptr<Region> region, aa
samplecnt_t fade_len;
if (fadein != NULL) {
fade_shape = aaf_fade_interpol_to_ardour_fade_shape ((aafiInterpolation_e) (fadein->flags & AAFI_INTERPOL_MASK));
fade_shape = aaf_fade_interpol_to_ardour_fade_shape ((aafiInterpolation_e)(fadein->flags & AAFI_INTERPOL_MASK));
fade_len = aafi_convertUnit (fadein->len, aafAudioClip->track->edit_rate, samplerate);
std::dynamic_pointer_cast<AudioRegion> (region)->set_fade_in (fade_shape, fade_len);
}
if (fadeout != NULL) {
fade_shape = aaf_fade_interpol_to_ardour_fade_shape ((aafiInterpolation_e) (fadeout->flags & AAFI_INTERPOL_MASK));
fade_shape = aaf_fade_interpol_to_ardour_fade_shape ((aafiInterpolation_e)(fadeout->flags & AAFI_INTERPOL_MASK));
fade_len = aafi_convertUnit (fadeout->len, aafAudioClip->track->edit_rate, samplerate);
std::dynamic_pointer_cast<AudioRegion> (region)->set_fade_out (fade_shape, fade_len);
@ -437,7 +461,6 @@ ARDOUR_UI::new_session_from_aaf (string const& aaf, string const& target_dir, st
aafi_set_debug (aafi, VERB_DEBUG, 0, NULL, &aaf_debug_callback, this);
if (aafi_load_file (aafi, aaf.c_str ())) {
error << "AAF: Could not load AAF file." << endmsg;
aafi_release (&aafi);
@ -446,8 +469,8 @@ ARDOUR_UI::new_session_from_aaf (string const& aaf, string const& target_dir, st
/* extract or set session name */
if (aafi->compositionName && aafi->compositionName[0] != 0x00) {
string compositionName = string(aafi->compositionName);
snapshot = laaf_util_clean_filename (&compositionName[0]);
string compositionName = string (aafi->compositionName);
snapshot = laaf_util_clean_filename (&compositionName[0]);
} else {
snapshot = basename_nosuffix (aaf);
}
@ -456,7 +479,7 @@ ARDOUR_UI::new_session_from_aaf (string const& aaf, string const& target_dir, st
path = Glib::build_filename (target_dir, snapshot);
if (Glib::file_test (path, Glib::FILE_TEST_EXISTS)) {
error << string_compose (_("AAF: Destination '%1' already exists."), path) << endmsg;
error << string_compose (_ ("AAF: Destination '%1' already exists."), path) << endmsg;
snapshot = ""; // XXX?
path = "";
aafi_release (&aafi);
@ -465,10 +488,10 @@ ARDOUR_UI::new_session_from_aaf (string const& aaf, string const& target_dir, st
/* Create media cache */
GError* err = NULL;
char* td = g_dir_make_tmp ("aaf-cache-XXXXXX", &err);
char* td = g_dir_make_tmp ("aaf-cache-XXXXXX", &err);
if (!td) {
error << string_compose (_("AAF: Could not prepare media cache: %1"), err->message) << endmsg;
error << string_compose (_ ("AAF: Could not prepare media cache: %1"), err->message) << endmsg;
aafi_release (&aafi);
return -1;
}
@ -487,16 +510,16 @@ ARDOUR_UI::new_session_from_aaf (string const& aaf, string const& target_dir, st
samplerate_r.denominator = 1;
std::string restore_backend;
if (!AudioEngine::instance()->running ()) {
AudioEngine* e = AudioEngine::instance();
if (!AudioEngine::instance ()->running ()) {
AudioEngine* e = AudioEngine::instance ();
restore_backend = e->current_backend_name ();
e->set_backend ("None (Dummy)", "", "");
e->start ();
PluginManager::instance ().refresh (true);
attach_to_engine ();
}
if (!AudioEngine::instance()->running ()) {
PBD::error << _("AAF: Could not start [dummy] engine for AAF import .") << endmsg;
if (!AudioEngine::instance ()->running ()) {
PBD::error << _ ("AAF: Could not start [dummy] engine for AAF import .") << endmsg;
return -1;
}
@ -506,10 +529,10 @@ ARDOUR_UI::new_session_from_aaf (string const& aaf, string const& target_dir, st
aafi_release (&aafi);
PBD::remove_directory (media_cache_path);
if (!restore_backend.empty ()) {
AudioEngine::instance()->stop ();
AudioEngine::instance()->set_backend (restore_backend, "", "");
AudioEngine::instance ()->stop ();
AudioEngine::instance ()->set_backend (restore_backend, "", "");
}
error << _("AAF: Could not create new session for AAF import .") << endmsg;
error << _ ("AAF: Could not create new session for AAF import .") << endmsg;
return -1;
}
@ -547,15 +570,15 @@ ARDOUR_UI::new_session_from_aaf (string const& aaf, string const& target_dir, st
/* Import Sources */
SourceList oneClipSources;
SourceList* oneClipSources;
ARDOUR::ImportStatus import_status;
vector<std::shared_ptr<Region>> source_regions;
timepos_t pos = timepos_t::max (Temporal::AudioTime);
aafiAudioTrack* aafAudioTrack = NULL;
aafiTimelineItem* aafAudioItem = NULL;
aafiAudioClip* aafAudioClip = NULL;
aafiAudioEssencePointer *aafAudioEssencePtr = NULL;
aafiAudioTrack* aafAudioTrack = NULL;
aafiTimelineItem* aafAudioItem = NULL;
aafiAudioClip* aafAudioClip = NULL;
aafiAudioEssencePointer* aafAudioEssencePtr = NULL;
aafPosition_t sessionStart = aafi_convertUnit (aafi->compositionStart, aafi->compositionStart_editRate, &samplerate_r);
@ -572,19 +595,19 @@ ARDOUR_UI::new_session_from_aaf (string const& aaf, string const& target_dir, st
}
if (aafAudioClip->essencePointerList == NULL) {
error << _("AAF: Clip has no essence.") << endmsg;
error << _ ("AAF: Clip has no essence.") << endmsg;
continue;
}
int essenceError = 0;
char *essenceName = aafAudioClip->essencePointerList->essenceFile->name;
AAFI_foreachEssencePointer (aafAudioClip->essencePointerList, aafAudioEssencePtr) {
int essenceError = 0;
char* essenceName = aafAudioClip->essencePointerList->essenceFile->name;
AAFI_foreachEssencePointer (aafAudioClip->essencePointerList, aafAudioEssencePtr)
{
struct aafiAudioEssenceFile* audioEssenceFile = aafAudioEssencePtr->essenceFile;
if (!audioEssenceFile) {
PBD::error << string_compose (_("AAF: Could not create new region for clip '%1': Missing audio essence"), audioEssenceFile->unique_name) << endmsg;
PBD::error << string_compose (_ ("AAF: Could not create new region for clip '%1': Missing audio essence"), audioEssenceFile->unique_name) << endmsg;
essenceError++;
continue;
}
@ -607,27 +630,27 @@ ARDOUR_UI::new_session_from_aaf (string const& aaf, string const& target_dir, st
continue;
}
if (!import_sndfile_as_region (_session, aafAudioClip->essencePointerList, SrcBest, pos, oneClipSources, import_status, source_regions)) {
if (!import_sndfile_as_region (_session, aafAudioClip->essencePointerList, SrcBest, pos, &oneClipSources, import_status, source_regions)) {
PBD::error << string_compose ("AAF: Could not import '%1' to session.", essenceName) << endmsg;
continue;
}
else {
AAFI_foreachEssencePointer (aafAudioClip->essencePointerList, aafAudioEssencePtr) {
} else {
AAFI_foreachEssencePointer (aafAudioClip->essencePointerList, aafAudioEssencePtr)
{
if (aafAudioEssencePtr->essenceFile->is_embedded) {
g_unlink (aafAudioEssencePtr->essenceFile->usable_file_path);
}
}
}
if (oneClipSources.size () == 0) {
error << string_compose (_("AAF: Could not create new region for clip '%1': Region has no source"), essenceName) << endmsg;
if (!oneClipSources || oneClipSources->size () == 0) {
error << string_compose (_ ("AAF: Could not create new region for clip '%1': Region has no source"), essenceName) << endmsg;
continue;
}
std::shared_ptr<Region> region = create_region (source_regions, aafAudioClip, oneClipSources, sessionStart, samplerate_r);
std::shared_ptr<Region> region = create_region (source_regions, aafAudioClip, *oneClipSources, sessionStart, samplerate_r);
if (!region) {
error << string_compose (_("AAF: Could not create new region for clip '%1'"), essenceName) << endmsg;
error << string_compose (_ ("AAF: Could not create new region for clip '%1'"), essenceName) << endmsg;
continue;
}
@ -643,11 +666,12 @@ ARDOUR_UI::new_session_from_aaf (string const& aaf, string const& target_dir, st
}
}
oneClipSources.clear ();
// oneClipSources.clear ();
aafiMarker* marker = NULL;
AAFI_foreachMarker (aafi, marker) {
AAFI_foreachMarker (aafi, marker)
{
aafPosition_t markerStart = sessionStart + aafi_convertUnit (marker->start, marker->edit_rate, &samplerate_r);
aafPosition_t markerEnd = sessionStart + aafi_convertUnit ((marker->start + marker->length), marker->edit_rate, &samplerate_r);
@ -691,8 +715,8 @@ ARDOUR_UI::new_session_from_aaf (string const& aaf, string const& target_dir, st
aafi_release (&aafi);
if (!restore_backend.empty ()) {
AudioEngine::instance()->stop ();
AudioEngine::instance()->set_backend (restore_backend, "", "");
AudioEngine::instance ()->stop ();
AudioEngine::instance ()->set_backend (restore_backend, "", "");
}
return 0;
}

View File

@ -1951,8 +1951,8 @@ retrieveProperty (AAF_Data* aafd, aafObject* Obj, aafPropertyDef* Def, aafProper
Prop->sf = p->_storedForm;
/*
TODO Prop->len / Prop->val ---> retrieveStrongReference() retrieveStrongReferenceSet() retrieveStrongReferenceVector()
only used to retrieve node name ? There could be a better approach.
TODO Prop->len / Prop->val ---> retrieveStrongReference() retrieveStrongReferenceSet() retrieveStrongReferenceVector()
only used to retrieve node name ? There could be a better approach.
*/
Prop->len = p->_length;
@ -2127,18 +2127,18 @@ getNodeProperties (AAF_Data* aafd, cfbNode* Node)
*/
/*
uint32_t prop_sz = sizeof(aafPropertyIndexHeader_t);
uint32_t prop_sz = sizeof(aafPropertyIndexHeader_t);
uint32_t i = 0;
uint32_t i = 0;
for ( i = 0; i < ((aafPropertyIndexHeader_t*)stream)->_entryCount; i++ )
prop_sz += (((aafPropertyIndexEntry_t*)(stream+((sizeof(aafPropertyIndexEntry_t)*i)+sizeof(aafPropertyIndexHeader_t))))->_length) + sizeof(aafPropertyIndexEntry_t);
for ( i = 0; i < ((aafPropertyIndexHeader_t*)stream)->_entryCount; i++ )
prop_sz += (((aafPropertyIndexEntry_t*)(stream+((sizeof(aafPropertyIndexEntry_t)*i)+sizeof(aafPropertyIndexHeader_t))))->_length) + sizeof(aafPropertyIndexEntry_t);
if ( prop_sz != stream_sz )
warning( L"Stream length (%lu Bytes) does not match property length (%u Bytes).",
stream_sz,
prop_sz );
*/
if ( prop_sz != stream_sz )
warning( L"Stream length (%lu Bytes) does not match property length (%u Bytes).",
stream_sz,
prop_sz );
*/
return stream;
}

View File

@ -131,7 +131,7 @@ aaf_dump_TaggedValueSet (AAF_Data* aafd, aafObject* ObjCollection, const char* p
ANSI_COLOR_DARKGREY (log),
(name) ? name : "<unknown>",
ANSI_COLOR_RESET (log),
(name) ? (size_t) (34 - (int)strlen (name)) : (size_t) (34 - strlen ("<unknown>")), " ",
(name) ? (size_t)(34 - (int)strlen (name)) : (size_t)(34 - strlen ("<unknown>")), " ",
ANSI_COLOR_DARKGREY (log),
aaft_TypeIDToText (&indirect->TypeDef),
ANSI_COLOR_RESET (log),

View File

@ -888,3 +888,44 @@ externalAudioDataReaderCallback (unsigned char* buf, size_t offset, size_t reqle
return byteRead;
}
aafiAudioEssencePointer*
aafi_audioEssencePointer_exists_before (AAF_Iface* aafi, aafiAudioEssencePointer* audioEssencePointerList)
{
aafiAudioTrack* at = NULL;
aafiTimelineItem* ai = NULL;
aafiAudioClip* ac = NULL;
aafiAudioEssencePointer* aep1 = NULL;
aafiAudioEssencePointer* aep2 = NULL;
AAFI_foreachAudioTrack (aafi, at)
{
AAFI_foreachTrackItem (at, ai)
{
if (ai->type != AAFI_AUDIO_CLIP) {
continue;
}
ac = (aafiAudioClip*)ai->data;
aep1 = audioEssencePointerList;
int found = 1;
AAFI_foreachEssencePointer (ac->essencePointerList, aep2)
{
if (!aep1 || aep1->essenceFile != aep2->essenceFile || aep1->essenceChannel != aep2->essenceChannel) {
found = 0;
break;
}
aep1 = aep1->next;
}
if (found && aep1 == NULL) {
return ac->essencePointerList;
}
}
}
return NULL;
}

View File

@ -3166,12 +3166,23 @@ aafi_retrieveData (AAF_Iface* aafi)
AAFI_foreachTrackItem (audioTrack, audioItem)
{
if (audioItem->type == AAFI_TRANS) {
if (audioItem->type != AAFI_AUDIO_CLIP) {
continue;
}
audioClip = (aafiAudioClip*)audioItem->data;
audioClip->channels = aafi_getAudioEssencePointerChannelCount (audioClip->essencePointerList);
/*
* we check if any previous clip is using the exact same essence pointer,
* to avoid duplication and allow to detect when multiple clips are using
* the same essence.
*/
aafiAudioEssencePointer* prev = aafi_audioEssencePointer_exists_before (aafi, audioClip->essencePointerList);
if (prev) {
audioClip->essencePointerList = prev;
}
}
}

View File

@ -214,6 +214,12 @@ aafi_release (AAF_Iface** aafi)
aafi_freeAudioTracks (&(*aafi)->Audio->Tracks);
aafi_freeAudioEssences (&(*aafi)->Audio->essenceFiles);
aafiAudioEssencePointer* essencePointer = (*aafi)->Audio->essencePointerList;
while (essencePointer) {
essencePointer = aafi_freeAudioEssencePointer (essencePointer);
}
free ((*aafi)->Audio);
}
@ -358,7 +364,7 @@ aafi_convertUnit (aafPosition_t value, aafRational_t* valueEditRate, aafRational
return 0;
}
return (aafPosition_t) ((double)value * (destEditRateFloat / valueEditRateFloat));
return (aafPosition_t)((double)value * (destEditRateFloat / valueEditRateFloat));
}
uint64_t
@ -391,7 +397,7 @@ aafi_convertUnitUint64 (aafPosition_t value, aafRational_t* valueEditRate, aafRa
return 0;
}
return (uint64_t) ((double)value * (destEditRateFloat / valueEditRateFloat));
return (uint64_t)((double)value * (destEditRateFloat / valueEditRateFloat));
}
int
@ -506,8 +512,8 @@ aafi_applyGainOffset (AAF_Iface* aafi, aafiAudioGain** gain, aafiAudioGain* offs
* is the same accross all gains in file. Thus, we devide both gain numbers
* by offset denominator, so we fit inside uint32_t.
*/
(*gain)->value[i].numerator = (int32_t) (((int64_t) (*gain)->value[i].numerator * (int64_t)offset->value[0].numerator) / (int64_t)offset->value[0].denominator);
(*gain)->value[i].denominator = (int32_t) (((int64_t) (*gain)->value[i].denominator * (int64_t)offset->value[0].denominator) / (int64_t)offset->value[0].denominator);
(*gain)->value[i].numerator = (int32_t)(((int64_t)(*gain)->value[i].numerator * (int64_t)offset->value[0].numerator) / (int64_t)offset->value[0].denominator);
(*gain)->value[i].denominator = (int32_t)(((int64_t)(*gain)->value[i].denominator * (int64_t)offset->value[0].denominator) / (int64_t)offset->value[0].denominator);
// debug( "Setting (*gain)->value[%i] = %i/%i * %i/%i",
// i,
// (*gain)->value[i].numerator,
@ -798,11 +804,11 @@ aafi_newAudioEssencePointer (AAF_Iface* aafi, aafiAudioEssencePointer** list, aa
last->next = essencePointer;
} else {
*list = essencePointer;
essencePointer->aafiNext = aafi->Audio->essencePointerList;
aafi->Audio->essencePointerList = essencePointer;
}
essencePointer->aafiNext = aafi->Audio->essencePointerList;
aafi->Audio->essencePointerList = essencePointer;
return *list;
}
@ -985,8 +991,6 @@ aafi_freeAudioClip (aafiAudioClip* audioClip)
aafi_freeAudioGain (audioClip->automation);
aafi_freeMetadata (&(audioClip->metadata));
aafi_freeAudioEssencePointer (audioClip->essencePointerList);
free (audioClip);
}
@ -1042,16 +1046,14 @@ aafi_freeMetadata (aafiMetaData** CommentList)
*CommentList = NULL;
}
void
aafiAudioEssencePointer*
aafi_freeAudioEssencePointer (aafiAudioEssencePointer* essencePointer)
{
aafiAudioEssencePointer* next = NULL;
aafiAudioEssencePointer* next = essencePointer->aafiNext;
while (essencePointer) {
next = essencePointer->next;
free (essencePointer);
essencePointer = next;
}
free (essencePointer);
return next;
}
void

View File

@ -1912,19 +1912,19 @@ aaft_PIDToText (AAF_Data* aafd, aafPID_t pid)
return "PID_BWFImportDescriptor_UnknownBWFChunks";
/* the following is marked as "dynamic" in ref implementation :
* AAF/ref-impl/include/ref-api/AAFTypes.h
*
* case PID_MPEGVideoDescriptor_SingleSequence:
* case PID_MPEGVideoDescriptor_ConstantBPictureCount:
* case PID_MPEGVideoDescriptor_CodedContentScanning:
* case PID_MPEGVideoDescriptor_LowDelay:
* case PID_MPEGVideoDescriptor_ClosedGOP:
* case PID_MPEGVideoDescriptor_IdenticalGOP:
* case PID_MPEGVideoDescriptor_MaxGOP:
* case PID_MPEGVideoDescriptor_MaxBPictureCount:
* case PID_MPEGVideoDescriptor_BitRate:
* case PID_MPEGVideoDescriptor_ProfileAndLevel:
*/
* AAF/ref-impl/include/ref-api/AAFTypes.h
*
* case PID_MPEGVideoDescriptor_SingleSequence:
* case PID_MPEGVideoDescriptor_ConstantBPictureCount:
* case PID_MPEGVideoDescriptor_CodedContentScanning:
* case PID_MPEGVideoDescriptor_LowDelay:
* case PID_MPEGVideoDescriptor_ClosedGOP:
* case PID_MPEGVideoDescriptor_IdenticalGOP:
* case PID_MPEGVideoDescriptor_MaxGOP:
* case PID_MPEGVideoDescriptor_MaxBPictureCount:
* case PID_MPEGVideoDescriptor_BitRate:
* case PID_MPEGVideoDescriptor_ProfileAndLevel:
*/
case PID_ClassDefinition_ParentClass:
return "PID_ClassDefinition_ParentClass";

View File

@ -729,7 +729,7 @@ cfb_getStream (CFB_Data* cfbd, cfbNode* node, unsigned char** stream, uint64_t*
return 0;
}
cpy_sz = ((stream_len - offset) < (uint64_t) (1 << cfbd->hdr->_uMiniSectorShift)) ? (stream_len - offset) : (uint64_t) (1 << cfbd->hdr->_uMiniSectorShift);
cpy_sz = ((stream_len - offset) < (uint64_t)(1 << cfbd->hdr->_uMiniSectorShift)) ? (stream_len - offset) : (uint64_t)(1 << cfbd->hdr->_uMiniSectorShift);
memcpy (*stream + offset, buf, cpy_sz);
@ -740,7 +740,7 @@ cfb_getStream (CFB_Data* cfbd, cfbNode* node, unsigned char** stream, uint64_t*
} else {
CFB_foreachSectorInChain (cfbd, buf, id)
{
cpy_sz = ((stream_len - offset) < (uint64_t) (1 << cfbd->hdr->_uSectorShift)) ? (stream_len - offset) : (uint64_t) (1 << cfbd->hdr->_uSectorShift);
cpy_sz = ((stream_len - offset) < (uint64_t)(1 << cfbd->hdr->_uSectorShift)) ? (stream_len - offset) : (uint64_t)(1 << cfbd->hdr->_uSectorShift);
memcpy (*stream + offset, buf, cpy_sz);
@ -1073,7 +1073,7 @@ cfb_retrieveMiniFAT (CFB_Data* cfbd)
* its ID (a.k.a SID) :
*
* ```
cfbNode *node = CFB_Data.nodes[ID];
cfbNode *node = CFB_Data.nodes[ID];
* ```
*
* @param cfbd Pointer to the CFB_Data structure.

View File

@ -92,16 +92,16 @@ typedef SSIZE_T ssize_t;
(uri->scheme_t != URI_SCHEME_T_FILE && \
!(uri->opts & URI_OPT_IGNORE_FRAGMENT))
#define URI_SET_STR(str, start, end) \
\
str = malloc (sizeof (char) * (uint32_t) ((end - start) + 1)); \
\
if (!str) { \
error ("Out of memory"); \
goto err; \
} \
\
snprintf (str, (uint32_t) (end - start) + 1, "%s", start);
#define URI_SET_STR(str, start, end) \
\
str = malloc (sizeof (char) * (uint32_t)((end - start) + 1)); \
\
if (!str) { \
error ("Out of memory"); \
goto err; \
} \
\
snprintf (str, (uint32_t)(end - start) + 1, "%s", start);
static char*
uriDecodeString (char* src, char* dst);
@ -787,7 +787,7 @@ uriIsIPv6 (const char* s, size_t size, char** err)
if (!IS_DIGIT (*(s + i))) {
loopback = -1;
} else {
loopback += (*(s + i) - '0'); //atoi(*(s+i));
loopback += (*(s + i) - '0'); // atoi(*(s+i));
}
}

View File

@ -556,19 +556,19 @@ typedef struct _aafData {
*/
#define aafUIDCmp(auid1, auid2) \
((auid1) != NULL && \
((auid2)) != NULL && \
(auid1)->Data1 == (auid2)->Data1 && \
(auid1)->Data2 == (auid2)->Data2 && \
(auid1)->Data3 == (auid2)->Data3 && \
(auid1)->Data4[0] == (auid2)->Data4[0] && \
(auid1)->Data4[1] == (auid2)->Data4[1] && \
(auid1)->Data4[2] == (auid2)->Data4[2] && \
(auid1)->Data4[3] == (auid2)->Data4[3] && \
(auid1)->Data4[4] == (auid2)->Data4[4] && \
(auid1)->Data4[5] == (auid2)->Data4[5] && \
(auid1)->Data4[6] == (auid2)->Data4[6] && \
(auid1)->Data4[7] == (auid2)->Data4[7])
((auid1) != NULL && \
(auid2) != NULL && \
(auid1)->Data1 == (auid2)->Data1 && \
(auid1)->Data2 == (auid2)->Data2 && \
(auid1)->Data3 == (auid2)->Data3 && \
(auid1)->Data4[0] == (auid2)->Data4[0] && \
(auid1)->Data4[1] == (auid2)->Data4[1] && \
(auid1)->Data4[2] == (auid2)->Data4[2] && \
(auid1)->Data4[3] == (auid2)->Data4[3] && \
(auid1)->Data4[4] == (auid2)->Data4[4] && \
(auid1)->Data4[5] == (auid2)->Data4[5] && \
(auid1)->Data4[6] == (auid2)->Data4[6] && \
(auid1)->Data4[7] == (auid2)->Data4[7])
/**
* Compares two aafMobID_t, returns 1 if equal or 0 otherwise.
@ -601,7 +601,7 @@ typedef struct _aafData {
*/
#define aafRationalToint64(r) \
(((r).denominator == 0) ? 0 : (int64_t) ((r).numerator / (r).denominator))
(((r).denominator == 0) ? 0 : (int64_t)((r).numerator / (r).denominator))
/**
* Loops through each aafPropertyIndexEntry_t of a "properties" node stream.

View File

@ -55,6 +55,9 @@ aafi_parse_audio_essence (AAF_Iface* aafi, aafiAudioEssenceFile* audioEssenceFil
int
aafi_build_unique_audio_essence_name (AAF_Iface* aafi, aafiAudioEssenceFile* audioEssenceFile);
aafiAudioEssencePointer*
aafi_audioEssencePointer_exists_before (AAF_Iface* aafi, aafiAudioEssencePointer* audioEssencePointerList);
/**
* @}
*/

View File

@ -468,11 +468,11 @@ typedef struct aafiAudioClip {
*/
/*
* set with CompoMob's SourceClip::StartTime. In the case of an OperationGroup(AudioChannelCombiner),
* There is one SourceClip per audio channel. So even though it's very unlikely, there could possibly
* be one essence_offset per channel.
* Value is in edit unit, edit rate definition is aafiAudioTrack->edit_rate
*/
* set with CompoMob's SourceClip::StartTime. In the case of an OperationGroup(AudioChannelCombiner),
* There is one SourceClip per audio channel. So even though it's very unlikely, there could possibly
* be one essence_offset per channel.
* Value is in edit unit, edit rate definition is aafiAudioTrack->edit_rate
*/
aafPosition_t essence_offset;
aafiMetaData* metadata;
@ -1060,7 +1060,7 @@ aafi_freeMarkers (aafiMarker** aafi);
void
aafi_freeMetadata (aafiMetaData** CommentList);
void
aafiAudioEssencePointer*
aafi_freeAudioEssencePointer (aafiAudioEssencePointer* audioEssenceGroupEntry);
void

View File

@ -57,33 +57,33 @@ typedef enum aafStoredForm_e {
typedef int32_t AAFTypeCategory_t;
typedef enum _eAAFTypeCategory_e
{
AAFTypeCatUnknown = 0, // can only occur in damaged files
AAFTypeCatInt = 1, // any integral type
AAFTypeCatCharacter = 2, // any character type
AAFTypeCatStrongObjRef = 3, // strong object reference
AAFTypeCatWeakObjRef = 4, // weak object reference
AAFTypeCatRename = 5, // renamed type
AAFTypeCatEnum = 6, // enumerated type
AAFTypeCatFixedArray = 7, // fixed-size array
AAFTypeCatVariableArray = 8, // variably-sized array
AAFTypeCatSet = 9, // set of strong object references or
// set of weak object references
AAFTypeCatRecord = 10, // a structured type
AAFTypeCatStream = 11, // potentially huge amount of data
AAFTypeCatString = 12, // null-terminated variably-sized
// array of characters
AAFTypeCatExtEnum = 13, // extendible enumerated type
AAFTypeCatIndirect = 14, // type must be determined at runtime
AAFTypeCatOpaque = 15, // type can be determined at runtime
AAFTypeCatEncrypted = 16 // type can be determined at runtime
// but bits are encrypted
AAFTypeCatUnknown = 0, // can only occur in damaged files
AAFTypeCatInt = 1, // any integral type
AAFTypeCatCharacter = 2, // any character type
AAFTypeCatStrongObjRef = 3, // strong object reference
AAFTypeCatWeakObjRef = 4, // weak object reference
AAFTypeCatRename = 5, // renamed type
AAFTypeCatEnum = 6, // enumerated type
AAFTypeCatFixedArray = 7, // fixed-size array
AAFTypeCatVariableArray = 8, // variably-sized array
AAFTypeCatSet = 9, // set of strong object references or
// set of weak object references
AAFTypeCatRecord = 10, // a structured type
AAFTypeCatStream = 11, // potentially huge amount of data
AAFTypeCatString = 12, // null-terminated variably-sized
// array of characters
AAFTypeCatExtEnum = 13, // extendible enumerated type
AAFTypeCatIndirect = 14, // type must be determined at runtime
AAFTypeCatOpaque = 15, // type can be determined at runtime
AAFTypeCatEncrypted = 16 // type can be determined at runtime
// but bits are encrypted
} AAFTypeCategory_e;
*/
/*
* :: Types Definition
* see Git nevali/aaf/ref-impl/include/ref-api/AAFTypes.h
*/
*/
typedef unsigned char aafByte_t;
@ -369,7 +369,7 @@ typedef struct _aafRGBAComponent_t {
} aafRGBAComponent_t;
//typedef aafRGBAComponent_t aafRGBALayout[8];
// typedef aafRGBAComponent_t aafRGBALayout[8];
/**
* This structure map the first bytes in a **properties** stream
@ -521,7 +521,7 @@ typedef struct aafStrongRefSetEntry_t {
* of the first aafStrongRefSetEntry_t is used to
* form the name of the first element in the set and so
* on. The #_localKey is an insertion key.
*/
*/
uint32_t _localKey;
@ -588,7 +588,7 @@ typedef struct aafStrongRefVectorEntry_t {
* of the first aafStrongRefVectorEntry_t is used to
* form the name of the first element in the vector and so
* on. The #_localKey is an insertion key.
*/
*/
uint32_t _localKey;
@ -679,15 +679,15 @@ typedef struct _WeakReferenceIndexHeader {
/*
typedef struct _aafIndirect_t
{
int type;
size_t size;
aafByte_t *data;
int type;
size_t size;
aafByte_t *data;
} aafIndirect_t;
typedef struct _AAF_TaggedValueClass
{
aafString_t Name;
aafIndirect_t Value;
aafString_t Name;
aafIndirect_t Value;
} AAF_ObjTaggedValue;
*/

View File

@ -710,7 +710,7 @@ typedef struct CFB_Data {
*/
#define CFB_getNodeStreamLen(cfbd, node) \
((cfbd->hdr->_uSectorShift > 9) ? (uint64_t) (((uint64_t) (node->_ulSizeHigh) << 32) | (node->_ulSizeLow)) : node->_ulSizeLow)
((cfbd->hdr->_uSectorShift > 9) ? (uint64_t)(((uint64_t)(node->_ulSizeHigh) << 32) | (node->_ulSizeLow)) : node->_ulSizeLow)
#define CFB_getStreamSectorShift(cfbd, node) \
((CFB_getNodeStreamLen (cfbd, node) < cfbd->hdr->_ulMiniSectorCutoff) ? cfbd->hdr->_uMiniSectorShift : cfbd->hdr->_uSectorShift)

View File

@ -103,7 +103,7 @@ PACK (struct wavBextChunk {
unsigned char umid[64];
/* since bext v2 (2011)
*
*
* If any loudness parameter is not
* being used, its value shall be
* set to 0x7fff. Any value outside
@ -118,11 +118,11 @@ PACK (struct wavBextChunk {
char reserved[180];
/*
Because it is variable size, we
do not include coding history
in the bext structure. However,
we know it starts at the end
of bext structure when parsing.
Because it is variable size, we
do not include coding history
in the bext structure. However,
we know it starts at the end
of bext structure when parsing.
*/
});

View File

@ -1,2 +1,2 @@
#pragma once
#define LIBAAF_VERSION "v1.0-10-g13f0b0a"
#define LIBAAF_VERSION "v1.0-11-gb04c547"

View File

@ -263,7 +263,7 @@ laaf_util_build_path (const char* sep, const char* first, ...)
int written = snprintf (str + offset, len - offset, "%s%.*s",
((element_count == 0 && has_leading_sep) || (element_count > 0)) ? sep : "",
(uint32_t) (arglen - argstart),
(uint32_t)(arglen - argstart),
arg + argstart);
if (written < 0 || (size_t)written >= (len - offset)) {