MediaConnection: BufferSize should be inherited
* While it's trivial for audio to calculate the buffer size, it isn't the same for video.
This commit is contained in:
@@ -51,7 +51,7 @@ public:
|
|||||||
|
|
||||||
// Represents the buffer size, depends on the format set or negotiated
|
// Represents the buffer size, depends on the format set or negotiated
|
||||||
// for this connection.
|
// for this connection.
|
||||||
size_t BufferSize() const;
|
virtual size_t BufferSize() const = 0;
|
||||||
|
|
||||||
// Disconnect this connection. When a connection is disconnected,
|
// Disconnect this connection. When a connection is disconnected,
|
||||||
// it can be reused as brand new.
|
// it can be reused as brand new.
|
||||||
|
|||||||
@@ -114,6 +114,9 @@ public:
|
|||||||
|
|
||||||
void* Cookie() const;
|
void* Cookie() const;
|
||||||
|
|
||||||
|
virtual size_t BufferSize() const;
|
||||||
|
virtual void SetBufferSize(size_t bufferSize);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
BSimpleMediaConnection(
|
BSimpleMediaConnection(
|
||||||
media_connection_kinds kinds);
|
media_connection_kinds kinds);
|
||||||
@@ -122,6 +125,8 @@ protected:
|
|||||||
process_hook fProcessHook;
|
process_hook fProcessHook;
|
||||||
notify_hook fNotifyHook;
|
notify_hook fNotifyHook;
|
||||||
void* fBufferCookie;
|
void* fBufferCookie;
|
||||||
|
|
||||||
|
size_t fBufferSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -120,25 +120,6 @@ BMediaConnection::Release()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t
|
|
||||||
BMediaConnection::BufferSize() const
|
|
||||||
{
|
|
||||||
CALLED();
|
|
||||||
|
|
||||||
switch (fConnection.format.type) {
|
|
||||||
case B_MEDIA_RAW_AUDIO:
|
|
||||||
return fConnection.format.u.raw_audio.buffer_size;
|
|
||||||
|
|
||||||
case B_MEDIA_RAW_VIDEO:
|
|
||||||
return fConnection.format.u.raw_video.display.bytes_per_row *
|
|
||||||
fConnection.format.u.raw_video.display.line_count;
|
|
||||||
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BMediaConnection::Connected(const media_format& format)
|
BMediaConnection::Connected(const media_format& format)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -150,6 +150,20 @@ BSimpleMediaConnection::Cookie() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
size_t
|
||||||
|
BSimpleMediaConnection::BufferSize() const
|
||||||
|
{
|
||||||
|
return fBufferSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
BSimpleMediaConnection::SetBufferSize(size_t bufferSize)
|
||||||
|
{
|
||||||
|
fBufferSize = bufferSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BSimpleMediaInput::BSimpleMediaInput()
|
BSimpleMediaInput::BSimpleMediaInput()
|
||||||
:
|
:
|
||||||
BMediaConnection(B_MEDIA_INPUT),
|
BMediaConnection(B_MEDIA_INPUT),
|
||||||
|
|||||||
Reference in New Issue
Block a user