Commit ea8b8a17 authored by Jason Wood's avatar Jason Wood

Changed avfile references to a list of all known clips. Initially, this was...

Changed avfile references to a list of all known clips. Initially, this was done so that we could keep track of all clips, but now is not used - perhaps it should be reverted.

svn path=/trunk/kdenlive/; revision=294
parent 7a063158
......@@ -21,6 +21,8 @@
#include "avfile.h"
#include "docclipavfile.h"
AVFile::AVFile(const QString &name, const KURL &url) :
m_duration(0.0),
m_framesPerSecond(0)
......@@ -31,7 +33,7 @@ AVFile::AVFile(const QString &name, const KURL &url) :
setName(name);
}
m_refCount = 0;
m_referers.setAutoDelete(false);
m_url = url;
......@@ -110,22 +112,22 @@ GenTime AVFile::duration() const
return m_duration;
}
int AVFile::addReference()
int AVFile::addReference(DocClipAVFile *referer)
{
m_refCount++;
m_referers.append(referer);
return numReferences();
}
/** Removes the reference of this clip from this avFile. If the reference did not exist, a warning will be issued to stderr. Returns the number of references to avFile. */
int AVFile::removeReference()
int AVFile::removeReference(DocClipAVFile *referer)
{
m_refCount--;
m_referers.remove(referer);
return numReferences();
}
/** Returns the number of clips which reference this avFile. */
int AVFile::numReferences()
{
return m_refCount;
return m_referers.count();
}
/** Returns true if this AVFile has a known duration, false if it is, as of yet, undetermined. */
......@@ -133,3 +135,8 @@ bool AVFile::durationKnown()
{
return m_durationKnown;
}
QPtrList<DocClipAVFile> AVFile::references()
{
return m_referers;
}
......@@ -20,6 +20,7 @@
#include <qmap.h>
#include <qstring.h>
#include <qptrlist.h>
#include <kurl.h>
......@@ -33,6 +34,7 @@
*@author Jason Wood
*/
class DocClipAVFile;
class AVFile {
public:
......@@ -51,13 +53,17 @@ public:
/** returns the size of the file */
const signed int fileSize();
int numReferences();
/** Removes the reference of this clip from this avFile. If the reference did not exist, a warning will be issued to stderr. Returns the number of references to avFile. */
int removeReference();
/** Removes the reference of this clip from this avFile. If the reference did not exist, a
* warning will be issued to stderr. Returns the number of references to avFile. */
int removeReference(DocClipAVFile *referer);
/** Adds the given avFile to the list of references. If it was already
there, then nothing happens other than a warning to stderr.
there, then nothing happens other than a warning to stderr.
Returns the number of references to this AVFile. */
int addReference(DocClipAVFile *referer);
/** Return a list of references to this avfile. */
QPtrList<DocClipAVFile> references();
Returns the number of references to this AVFile. */
int addReference();
/** returns the duration of this file */
GenTime duration() const;
/** Returns true if this AVFile has a known duration, false if it is, as of yet, undetermined. */
......@@ -66,7 +72,7 @@ Returns the number of references to this AVFile. */
int framesPerSecond() const { return m_framesPerSecond; }
private: // Private attributes
/** Holds the url for this AV file. */
KURL m_url;;
KURL m_url;
/** The size in bytes of this AVFile */
signed int m_filesize;
/** The duration of this file. */
......@@ -75,8 +81,9 @@ private: // Private attributes
QString m_name;
/** True if the duration of this AVFile is known, false otherwise. */
bool m_durationKnown;
/** A list of all DocClipAVFiles which make use of this AVFile. This is used so that we can clean up if we decide to delete an AVFile. */
int m_refCount;
/** A list of all DocClipAVFiles which make use of this AVFile. This is used so that we can
* clean up if we decide to delete an AVFile. */
QPtrList<DocClipAVFile> m_referers;
/** The number of frames per second that this AVFile runs at. */
int m_framesPerSecond;
};
......
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