MediaPlayer: fix reporting wrong format

Now it allows to connect MediaPlayer video producer to differnt node in Cortex.

Change-Id: I7ee598ea64d10e8fa876259e7a4480a650a0e189
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3034
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>
This commit is contained in:
X512 2020-07-14 21:39:11 +09:00 committed by Adrien Destugues
parent d9f74c873b
commit f27269a67d
4 changed files with 26 additions and 8 deletions

View File

@ -357,14 +357,22 @@ VideoProducer::PrepareToConnect(const media_source& source,
return B_MEDIA_BAD_FORMAT;
}
if (format->u.raw_video.display.line_width == 0)
format->u.raw_video.display.line_width = 384;
if (format->u.raw_video.display.line_count == 0)
format->u.raw_video.display.line_count = 288;
if (format->u.raw_video.field_rate == 0)
format->u.raw_video.field_rate = 25.0;
if (format->u.raw_video.display.bytes_per_row == 0)
format->u.raw_video.display.bytes_per_row = format->u.raw_video.display.line_width * 4;
if (format->u.raw_video.display.line_width == 0) {
format->u.raw_video.display.line_width
= fSupplier->Format().u.raw_video.display.line_width;
}
if (format->u.raw_video.display.line_count == 0) {
format->u.raw_video.display.line_count
= fSupplier->Format().u.raw_video.display.line_count;
}
if (format->u.raw_video.field_rate == 0) {
format->u.raw_video.field_rate
= fSupplier->Format().u.raw_video.field_rate;
}
if (format->u.raw_video.display.bytes_per_row == 0) {
format->u.raw_video.display.bytes_per_row
= fSupplier->Format().u.raw_video.display.bytes_per_row;
}
*outSource = fOutput.source;
strcpy(outName, fOutput.name);

View File

@ -8,6 +8,7 @@
#include <SupportDefs.h>
#include <MediaFormats.h>
struct media_raw_video_format;
@ -18,6 +19,7 @@ public:
VideoSupplier();
virtual ~VideoSupplier();
virtual const media_format& Format() const = 0;
virtual status_t FillBuffer(int64 startFrame, void* buffer,
const media_raw_video_format& format,
bool forceGeneration, bool& wasCached) = 0;

View File

@ -28,6 +28,13 @@ ProxyVideoSupplier::~ProxyVideoSupplier()
}
const media_format&
ProxyVideoSupplier::Format() const
{
return fSupplier->Format();
}
status_t
ProxyVideoSupplier::FillBuffer(int64 startFrame, void* buffer,
const media_raw_video_format& format, bool forceGeneration,

View File

@ -18,6 +18,7 @@ public:
ProxyVideoSupplier();
virtual ~ProxyVideoSupplier();
virtual const media_format& Format() const;
virtual status_t FillBuffer(int64 startFrame, void* buffer,
const media_raw_video_format& format,
bool forceGeneration, bool& wasCached);