* cleanup, no functional change

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@27873 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Karsten Heimrich
2008-10-05 11:53:29 +00:00
parent 2617261d77
commit d2418e6b94
@@ -58,6 +58,7 @@ VideoNode::VideoNode(const char *name, BMediaAddOn* addon, int32 id)
_InitDisplay(); _InitDisplay();
} }
VideoNode::~VideoNode() VideoNode::~VideoNode()
{ {
Quit(); Quit();
@@ -103,9 +104,8 @@ VideoNode::BufferReceived(BBuffer * buffer)
HandleBuffer(buffer); HandleBuffer(buffer);
} else { } else {
media_timed_event event(buffer->Header()->start_time, media_timed_event event(buffer->Header()->start_time,
BTimedEventQueue::B_HANDLE_BUFFER, BTimedEventQueue::B_HANDLE_BUFFER, buffer,
buffer, BTimedEventQueue::B_RECYCLE_BUFFER);
BTimedEventQueue::B_RECYCLE_BUFFER);
EventQueue()->AddEvent(event); EventQueue()->AddEvent(event);
} }
} }
@@ -131,24 +131,23 @@ VideoNode::DisposeInputCookie(int32 cookie)
status_t status_t
VideoNode:: HandleMessage(int32 message, VideoNode:: HandleMessage(int32 message, const void *data, size_t size)
const void *data,
size_t size)
{ {
return B_ERROR; return B_ERROR;
} }
void void
VideoNode::HandleEvent(const media_timed_event *event, VideoNode::HandleEvent(const media_timed_event *event, bigtime_t lateness,
bigtime_t lateness, bool realTimeEvent)
bool realTimeEvent)
{ {
switch (event->type) { switch (event->type) {
case BTimedEventQueue::B_START: case BTimedEventQueue::B_START:
break; break;
case BTimedEventQueue::B_STOP: case BTimedEventQueue::B_STOP:
EventQueue()->FlushEvents(event->event_time, BTimedEventQueue::B_ALWAYS, true, BTimedEventQueue::B_HANDLE_BUFFER); EventQueue()->FlushEvents(event->event_time,
BTimedEventQueue::B_ALWAYS, true,
BTimedEventQueue::B_HANDLE_BUFFER);
break; break;
case BTimedEventQueue::B_HANDLE_BUFFER: case BTimedEventQueue::B_HANDLE_BUFFER:
HandleBuffer((BBuffer *)event->pointer); HandleBuffer((BBuffer *)event->pointer);
@@ -161,18 +160,16 @@ VideoNode::HandleEvent(const media_timed_event *event,
void void
VideoNode::ProducerDataStatus(const media_destination &dst, VideoNode::ProducerDataStatus(const media_destination &dst, int32 status,
int32 status, bigtime_t at_media_time)
bigtime_t at_media_time)
{ {
// do nothing // do nothing
} }
status_t status_t
VideoNode::GetLatencyFor(const media_destination &dst, VideoNode::GetLatencyFor(const media_destination &dst, bigtime_t *out_latency,
bigtime_t *out_latency, media_node_id *out_id)
media_node_id *out_id)
{ {
if (dst != fInput.destination) if (dst != fInput.destination)
return B_MEDIA_BAD_DESTINATION; return B_MEDIA_BAD_DESTINATION;
@@ -184,8 +181,7 @@ VideoNode::GetLatencyFor(const media_destination &dst,
status_t status_t
VideoNode::AcceptFormat(const media_destination &dst, VideoNode::AcceptFormat(const media_destination &dst, media_format *format)
media_format *format)
{ {
/* The connection process: /* The connection process:
* BBufferProducer::FormatProposal * BBufferProducer::FormatProposal
@@ -208,10 +204,8 @@ VideoNode::AcceptFormat(const media_destination &dst,
status_t status_t
VideoNode::Connected(const media_source &src, VideoNode::Connected(const media_source &src, const media_destination &dst,
const media_destination &dst, const media_format &format, media_input *out_input)
const media_format &format,
media_input *out_input)
{ {
/* The connection process: /* The connection process:
* BBufferProducer::FormatProposal * BBufferProducer::FormatProposal
@@ -231,18 +225,19 @@ VideoNode::Connected(const media_source &src,
fInput.format.u.raw_video.field_rate = 25.0; fInput.format.u.raw_video.field_rate = 25.0;
color_space colorspace = format.u.raw_video.display.format; color_space colorspace = format.u.raw_video.display.format;
BRect frame(0, 0, format.u.raw_video.display.line_width - 1, format.u.raw_video.display.line_count - 1); BRect frame(0, 0, format.u.raw_video.display.line_width - 1,
status_t err; format.u.raw_video.display.line_count - 1);
DeleteBuffers(); DeleteBuffers();
err = CreateBuffers(frame, colorspace, fOverlayEnabled); status_t err = CreateBuffers(frame, colorspace, fOverlayEnabled);
if (err && fOverlayEnabled) { if (err && fOverlayEnabled) {
SetOverlayEnabled(false); SetOverlayEnabled(false);
err = CreateBuffers(frame, colorspace, fOverlayEnabled); err = CreateBuffers(frame, colorspace, fOverlayEnabled);
} }
if (err) { if (err) {
fprintf(stderr, "VideoNode::Connected failed, fOverlayEnabled = %d\n", fOverlayEnabled); fprintf(stderr, "VideoNode::Connected failed, fOverlayEnabled = %d\n",
fOverlayEnabled);
return err; return err;
} }
@@ -253,8 +248,7 @@ VideoNode::Connected(const media_source &src,
void void
VideoNode::Disconnected(const media_source &src, VideoNode::Disconnected(const media_source &src, const media_destination &dst)
const media_destination &dst)
{ {
if (src != fInput.source) if (src != fInput.source)
return; return;
@@ -269,10 +263,8 @@ VideoNode::Disconnected(const media_source &src,
status_t status_t
VideoNode::FormatChanged(const media_source &src, VideoNode::FormatChanged(const media_source &src, const media_destination &dst,
const media_destination &dst, int32 from_change_count, const media_format &format)
int32 from_change_count,
const media_format &format)
{ {
if (src != fInput.source) if (src != fInput.source)
return B_MEDIA_BAD_SOURCE; return B_MEDIA_BAD_SOURCE;
@@ -280,8 +272,10 @@ VideoNode::FormatChanged(const media_source &src,
return B_MEDIA_BAD_DESTINATION; return B_MEDIA_BAD_DESTINATION;
color_space colorspace = format.u.raw_video.display.format; color_space colorspace = format.u.raw_video.display.format;
BRect frame(0, 0, format.u.raw_video.display.line_width - 1, format.u.raw_video.display.line_count - 1); BRect frame(0, 0, format.u.raw_video.display.line_width - 1,
status_t err; format.u.raw_video.display.line_count - 1);
status_t err;
DeleteBuffers(); DeleteBuffers();
if (fOverlayEnabled) { if (fOverlayEnabled) {
@@ -368,12 +362,17 @@ VideoNode::IsOverlayActive()
status_t status_t
VideoNode::CreateBuffers(BRect frame, color_space cspace, bool overlay) VideoNode::CreateBuffers(BRect frame, color_space cspace, bool overlay)
{ {
//printf("VideoNode::CreateBuffers: frame %d,%d,%d,%d colorspace 0x%08x, overlay %d\n", printf("VideoNode::CreateBuffers: frame %d,%d,%d,%d colorspace 0x%08x, "
// int(frame.left), int(frame.top), int(frame.right), int(frame.bottom), int(cspace), overlay); "overlay %d\n", int(frame.left), int(frame.top), int(frame.right),
int(frame.bottom), int(cspace), overlay);
LockBitmap(); LockBitmap();
ASSERT(fBitmap == 0); ASSERT(fBitmap == 0);
uint32 flags = overlay ? (B_BITMAP_WILL_OVERLAY | B_BITMAP_RESERVE_OVERLAY_CHANNEL) : 0;
uint32 flags = 0;
if (overlay)
flags = B_BITMAP_WILL_OVERLAY | B_BITMAP_RESERVE_OVERLAY_CHANNEL;
fBitmap = new BBitmap(frame, flags, cspace); fBitmap = new BBitmap(frame, flags, cspace);
if (!(fBitmap && fBitmap->InitCheck() == B_OK && fBitmap->IsValid())) { if (!(fBitmap && fBitmap->InitCheck() == B_OK && fBitmap->IsValid())) {
delete fBitmap; delete fBitmap;
@@ -405,7 +404,8 @@ VideoNode::_InitDisplay()
{ {
// TODO: Get rid of hardcoded values // TODO: Get rid of hardcoded values
BRect size(0,0,320,240); BRect size(0,0,320,240);
fVideoView = new VideoView(size, "Video View", B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE, this); fVideoView = new VideoView(size, "Video View", B_FOLLOW_ALL_SIDES,
B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE, this);
size.OffsetBy(40.f, 40.f); size.OffsetBy(40.f, 40.f);
fWindow = new VideoWindow(size, fVideoView); fWindow = new VideoWindow(size, fVideoView);