Skip to content
Snippets Groups Projects
Commit edf7a531 authored by Philippe Gorley's avatar Philippe Gorley
Browse files

media: update MediaStream objects if properties change

This sets the stage for automatic reinitialization of MediaFilter if the
input properties change.

Change-Id: I899834f0bbeb4ca0425fd6ba5a89460c0c9bda99
parent 4080a053
Branches
Tags
No related merge requests found
......@@ -80,9 +80,9 @@ struct MediaStream {
MediaStream(std::string name, AVCodecContext* c, int64_t firstTimestamp)
: name(name)
, firstTimestamp(firstTimestamp)
{
timeBase = c->time_base;
this->firstTimestamp = firstTimestamp;
switch (c->codec_type) {
case AVMEDIA_TYPE_VIDEO:
format = c->pix_fmt;
......@@ -114,6 +114,20 @@ struct MediaStream {
else
return sampleRate > 0 && nbChannels > 0;
}
void update(AVFrame* f)
{
// update all info possible (AVFrame has no fps data)
format = f->format;
if (isVideo) {
width = f->width;
height = f->height;
aspectRatio = f->sample_aspect_ratio;
} else {
sampleRate = f->sample_rate;
nbChannels = f->channels;
}
}
};
inline std::ostream& operator<<(std::ostream& os, const MediaStream& ms)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment