moved more objects to shared ptrs

This commit is contained in:
itsmattkc
2019-08-09 08:21:54 +10:00
parent dfd33310a2
commit f26eea1620
12 changed files with 33 additions and 28 deletions
+2 -2
View File
@@ -42,12 +42,12 @@ Decoder::~Decoder()
{
}
const Stream *Decoder::stream()
StreamPtr Decoder::stream()
{
return stream_;
}
void Decoder::set_stream(const Stream *fs)
void Decoder::set_stream(StreamPtr fs)
{
Close();
+3 -3
View File
@@ -80,8 +80,8 @@ public:
virtual QString id() = 0;
const Stream* stream();
void set_stream(const Stream *fs);
StreamPtr stream();
void set_stream(StreamPtr fs);
/**
* @brief Probe a footage file and dump metadata about it
@@ -194,7 +194,7 @@ protected:
bool open_;
private:
const Stream* stream_;
StreamPtr stream_;
};
#endif // DECODER_H
+4 -4
View File
@@ -346,12 +346,12 @@ bool FFmpegDecoder::Probe(Footage *f)
avstream_ = fmt_ctx_->streams[i];
Stream* str;
StreamPtr str;
if (avstream_->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) {
// Create a video stream object
VideoStream* video_stream = new VideoStream();
VideoStreamPtr video_stream = std::make_shared<VideoStream>();
video_stream->set_width(avstream_->codecpar->width);
video_stream->set_height(avstream_->codecpar->height);
@@ -361,7 +361,7 @@ bool FFmpegDecoder::Probe(Footage *f)
} else if (avstream_->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) {
// Create an audio stream object
AudioStream* audio_stream = new AudioStream();
AudioStreamPtr audio_stream = std::make_shared<AudioStream>();
audio_stream->set_layout(avstream_->codecpar->channel_layout);
audio_stream->set_channels(avstream_->codecpar->channels);
@@ -372,7 +372,7 @@ bool FFmpegDecoder::Probe(Footage *f)
} else {
// This is data we can't utilize at the moment, but we make a Stream object anyway to keep parity with the file
str = new Stream();
str = std::make_shared<Stream>();
// Set the correct codec type based on FFmpeg's result
switch (avstream_->codecpar->codec_type) {