While appending streams, the streamId and ordinalId were getting overwritten. Port::newStreamAt() now takes an additional parameter - pointer to stream (default NULL) which is used when appending streams
Fixes Issue 21
This commit is contained in:
parent
90fda499dd
commit
3aac690ed8
@ -65,13 +65,16 @@ void Port::reorderStreamsByOrdinals()
|
||||
qSort(mStreams.begin(), mStreams.end(), StreamBase::StreamLessThan);
|
||||
}
|
||||
|
||||
bool Port::newStreamAt(int index)
|
||||
bool Port::newStreamAt(int index, OstProto::Stream const *stream)
|
||||
{
|
||||
Stream *s = new Stream;
|
||||
|
||||
if (index > mStreams.size())
|
||||
return false;
|
||||
|
||||
if (stream)
|
||||
s->protoDataCopyFrom(*stream);
|
||||
|
||||
s->setId(newStreamId());
|
||||
mStreams.insert(index, s);
|
||||
updateStreamOrdinalsFromIndex();
|
||||
@ -235,8 +238,7 @@ bool Port::openStreams(QString fileName, bool append, QString &error)
|
||||
|
||||
for (int i = 0; i < streams.stream_size(); i++)
|
||||
{
|
||||
newStreamAt(mStreams.size());
|
||||
streamByIndex(mStreams.size()-1)->protoDataCopyFrom(streams.stream(i));
|
||||
newStreamAt(mStreams.size(), &streams.stream(i));
|
||||
}
|
||||
|
||||
emit streamListChanged(mPortGroupId, mPortId);
|
||||
|
@ -99,7 +99,7 @@ public:
|
||||
|
||||
//! Used by StreamModel
|
||||
//@{
|
||||
bool newStreamAt(int index);
|
||||
bool newStreamAt(int index, OstProto::Stream const *stream = NULL);
|
||||
bool deleteStreamAt(int index);
|
||||
//@}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user