Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit f74abaa5 authored by Jason Wood's avatar Jason Wood

Added pure virtual containsAVFile() method to docClipBase and derived classes.

svn path=/trunk/kdenlive/; revision=296
parent 5914120a
......@@ -25,35 +25,36 @@
DocClipAVFile::DocClipAVFile(KdenliveDoc *doc, const QString &name, const KURL &url) :
DocClipBase(doc),
m_avFile(doc->getAVFileReference(url))
m_avfile(doc->getAVFileReference(url))
{
setTrackEnd(trackStart() + duration());
setName(name);
m_avfile->addReference(this);
m_clipType = AV;
m_clipType = AV;
}
DocClipAVFile::DocClipAVFile(KdenliveDoc *doc, AVFile *avFile) :
DocClipBase(doc),
m_avFile(avFile)
m_avfile(avFile)
{
m_avFile->addReference();
m_avfile->addReference(this);
setTrackEnd(trackStart() + duration());
setName(m_avFile->name());
setName(m_avfile->name());
m_clipType = AV;
}
DocClipAVFile::~DocClipAVFile()
{
m_avFile->removeReference();
m_avFile = 0;
m_avfile->removeReference(this);
m_avfile = 0;
}
GenTime DocClipAVFile::duration() const
{
return m_avFile->duration();
return m_avfile->duration();
}
/** Returns the type of this clip */
......@@ -87,7 +88,7 @@ QDomDocument DocClipAVFile::toXML() {
/** Returns the url of the AVFile this clip contains */
KURL DocClipAVFile::fileURL()
{
return m_avFile->fileURL();
return m_avfile->fileURL();
}
/** Creates a clip from the passed QDomElement. This only pertains to those details specific to DocClipAVFile.*/
......@@ -105,13 +106,13 @@ DocClipAVFile * DocClipAVFile::createClip(KdenliveDoc *doc, const QDomElement el
/** Returns true if the clip duration is known, false otherwise. */
bool DocClipAVFile::durationKnown()
{
return m_avFile->durationKnown();
return m_avfile->durationKnown();
}
// virtual
int DocClipAVFile::framesPerSecond() const
{
return m_avFile->framesPerSecond();
return m_avfile->framesPerSecond();
}
......@@ -164,3 +165,9 @@ QValueVector<GenTime> DocClipAVFile::sceneTimes()
list.append(trackEnd());
return list;
}
// virtual
bool DocClipAVFile::containsAVFile(AVFile *file)
{
return (m_avfile == file);
}
......@@ -37,7 +37,7 @@ class DocClipAVFile : public DocClipBase {
Q_OBJECT
public:
DocClipAVFile(KdenliveDoc *doc, const QString &name, const KURL &url);
DocClipAVFile(KdenliveDoc *doc, AVFile *avFile);
DocClipAVFile(KdenliveDoc *doc, AVFile *avFile);
~DocClipAVFile();
QString fileName();
......@@ -60,12 +60,14 @@ public:
virtual QValueVector<GenTime> sceneTimes();
// Returns an XML document that describes part of the current scene.
virtual QDomDocument sceneToXML(const GenTime &startTime, const GenTime &endTime);
virtual bool containsAVFile(AVFile *file);
private:
/** A play object factory, used for calculating information, and previewing files */
/** Determines whether this file contains audio, video or both. */
DocClipBase::CLIPTYPE m_clipType;
/** Holds a pointer to an AVFile which contains details of the file this clip portrays. */
AVFile * m_avFile;
/** Holds a pointer to an AVFile which contains details of the file this clip portrays. */
AVFile * m_avfile;
};
#endif
......
......@@ -31,11 +31,12 @@
class KdenliveDoc;
class DocTrackBase;
class AVFile;
class DocClipBase : public QObject {
Q_OBJECT
public:
/** this enum determines the types of "feed" available within this clip. types must be non-exlcusive
/** this enum determines the types of "feed" available within this clip. types must be non-exclusive
* - e.g. if you can have audio and video seperately, it should be possible to combin the two, as is
* done here. If a new clip type is added then it should be possible to combine it with both audio
* and video. */
......@@ -109,31 +110,35 @@ public:
// Returns a list of times that this clip must break upon.
virtual QValueVector<GenTime> sceneTimes() = 0;
// Returns an XML document that describes part of the current scene.
virtual QDomDocument sceneToXML(const GenTime &startTime, const GenTime &endTime) = 0;
/** Returns true if the clip in some way includes he specified AVFile. */
virtual bool containsAVFile(AVFile *file) = 0;
private: // Private attributes
/** The name of this clip */
QString m_name;
/** Where this clip starts on the track that it resides on. */
GenTime m_trackStart;
/** The cropped start time for this clip - e.g. if the clip is 10 seconds long, this might say that the
* the bit we want starts 3 seconds in.
/** The cropped start time for this clip - e.g. if the clip is 10 seconds long, this
* might say that the the bit we want starts 3 seconds in.
**/
GenTime m_cropStart;
/** The end time of this clip on the track.
**/
GenTime m_trackEnd;
/** The track to which this clip is parented. If NULL, the clip is not
parented to any track. */
DocTrackBase * m_parentTrack;
/** The number of this track. This is the number of the track the clip resides on.
It is possible for this to be set and the parent track to be 0, in this situation
m_trackNum is a hint as to where the clip should be place when it get's parented
to a track. */
int m_trackNum;
/** The track to which this clip is parented. If NULL, the clip is not
parented to any track. */
DocTrackBase * m_parentTrack;
/** The number of this track. This is the number of the track the clip resides on.
It is possible for this to be set and the parent track to be 0, in this situation
m_trackNum is a hint as to where the clip should be place when it get's parented
to a track. */
int m_trackNum;
protected: // Protected attributes
/** the document this clip belongs to */
KdenliveDoc * m_document;
/** the document this clip belongs to */
KdenliveDoc * m_document;
};
#endif
......@@ -393,3 +393,42 @@ QDomDocument DocClipProject::sceneToXML(const GenTime &startTime, const GenTime
return doc;
}
// virtual
bool DocClipProject::containsAVFile(AVFile *file)
{
bool result = false;
for(uint count=0; (count < numTracks()) && (!result); ++count) {
DocTrackClipIterator itt(*(m_tracks.at(count)));
while(itt.current()) {
if(itt.current()->containsAVFile(file)) {
result = true;
break;
}
++itt;
}
}
return result;
}
QPtrList<DocClipBase> DocClipProject::referencedClips(AVFile *file)
{
QPtrList<DocClipBase> list;
list.setAutoDelete(false);
for(uint count=0; count<numTracks(); ++count) {
DocTrackClipIterator itt(*(m_tracks.at(count)));
while(itt.current()) {
if(itt.current()->containsAVFile(file)) {
list.append(itt.current());
}
++itt;
}
}
return list;
}
......@@ -77,6 +77,10 @@ public:
virtual QValueVector<GenTime> sceneTimes();
// Returns an XML document that describes part of the current scene.
virtual QDomDocument sceneToXML(const GenTime &startTime, const GenTime &endTime);
/** Returns true if the clip in some way includes he specified AVFile. */
virtual bool containsAVFile(AVFile *file);
QPtrList<DocClipBase> referencedClips(AVFile *file);
signals:
/** This signal is emitted whenever tracks are added to or removed from the project. */
void trackListChanged();
......
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