video_mixer: Fix build

* Unfortunately it's crashing the media_addon_server
at startup.
This commit is contained in:
Dario Casalinuovo 2016-02-13 16:00:14 +01:00
parent 44200efd5d
commit 127a93c293
7 changed files with 42 additions and 29 deletions

View File

@ -57,16 +57,17 @@ BufferMixer::Merge(BBuffer *input, BBuffer *output) {
uint32 size = input->Header()->size_used / 4; uint32 size = input->Header()->size_used / 4;
uint8 alpha = 0; uint8 alpha = 0;
uint8 c1, c2, c3; uint8 c1, c2, c3;
for (uint32 i=0; i<size; i++) { for (uint32 i=0; i<size; i++) {
c1 = *source++; c1 = *source++;
c2 = *source++; c2 = *source++;
c3 = *source++; c3 = *source++;
alpha = *source++; alpha = *source++;
*destination++ = ALPHABLEND(c1, *destination, alpha); *(destination) = ALPHABLEND(c1, *destination, alpha);
*destination++ = ALPHABLEND(c2, *destination, alpha); *(destination+1) = ALPHABLEND(c2, *destination, alpha);
*destination++ = ALPHABLEND(c3, *destination, alpha); *(destination+2) = ALPHABLEND(c3, *destination, alpha);
*destination++ = 0x00; *(destination+3) = 0x00;
destination += 4;
} }
} }
@ -91,7 +92,7 @@ void
BufferMixer::RemoveBuffer(int32 id) { BufferMixer::RemoveBuffer(int32 id) {
BBuffer *oldBuffer; BBuffer *oldBuffer;
if (id < groupedBuffers.size()) { if (uint32(id) < groupedBuffers.size()) {
oldBuffer = groupedBuffers[id]; oldBuffer = groupedBuffers[id];
groupedBuffers[id] = NULL; groupedBuffers[id] = NULL;

View File

@ -14,7 +14,7 @@ for architectureObject in [ MultiArchSubDirSetup ] {
CpuCapabilities.cpp CpuCapabilities.cpp
BufferMixer.cpp BufferMixer.cpp
yuvrgb.nasm yuvrgb.nasm
: be media : be media [ TargetLibsupc++ ] [ TargetLibstdc++ ]
; ;
} }
} }

View File

@ -21,6 +21,8 @@
#include "VideoMixerNode.h" #include "VideoMixerNode.h"
using std::vector;
VideoMixerNode::~VideoMixerNode(void) VideoMixerNode::~VideoMixerNode(void)
{ {
fprintf(stderr,"VideoMixerNode::~VideoMixerNode\n"); fprintf(stderr,"VideoMixerNode::~VideoMixerNode\n");
@ -29,9 +31,9 @@ VideoMixerNode::~VideoMixerNode(void)
} }
VideoMixerNode::VideoMixerNode( VideoMixerNode::VideoMixerNode(
const flavor_info *info = 0, const flavor_info *info,
BMessage *config = 0, BMessage *config,
BMediaAddOn *addOn = 0) BMediaAddOn *addOn)
: BMediaNode("VideoMixerNode"), : BMediaNode("VideoMixerNode"),
BBufferConsumer(B_MEDIA_RAW_VIDEO), // Raw video buffers in BBufferConsumer(B_MEDIA_RAW_VIDEO), // Raw video buffers in
BBufferProducer(B_MEDIA_RAW_VIDEO), // Raw video buffers out BBufferProducer(B_MEDIA_RAW_VIDEO), // Raw video buffers out
@ -303,8 +305,9 @@ void VideoMixerNode::GetFlavor(flavor_info *outInfo, int32 id)
if (outInfo != NULL) { if (outInfo != NULL) {
outInfo->internal_id = id; outInfo->internal_id = id;
outInfo->name = "Haiku VideoMixer"; strcpy(outInfo->name, "Haiku VideoMixer");
outInfo->info = "A VideoMixerNode node mixes multiple video streams into a single stream."; strcpy(outInfo->info, "A VideoMixerNode node mixes multiple video"
" streams into a single stream.");
outInfo->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER; outInfo->kinds = B_BUFFER_CONSUMER | B_BUFFER_PRODUCER;
outInfo->flavor_flags = B_FLAVOR_IS_LOCAL; outInfo->flavor_flags = B_FLAVOR_IS_LOCAL;
outInfo->possible_count = INT_MAX; // no limit outInfo->possible_count = INT_MAX; // no limit

View File

@ -12,6 +12,8 @@
#include "VideoMixerNode.h" #include "VideoMixerNode.h"
#include <stdio.h>
// -------------------------------------------------------- // // -------------------------------------------------------- //
// implemention of BBufferConsumer // implemention of BBufferConsumer
@ -46,7 +48,7 @@ status_t VideoMixerNode::GetNextInput(
fprintf(stderr,"VideoMixerNode(BBufferConsumer)::GetNextInput (%ld)\n",*cookie); fprintf(stderr,"VideoMixerNode(BBufferConsumer)::GetNextInput (%ld)\n",*cookie);
// Cookie 0 is the connecting input, all others are connected inputs // Cookie 0 is the connecting input, all others are connected inputs
if (*cookie == fConnectedInputs.size()) { if (uint32(*cookie) == fConnectedInputs.size()) {
*out_input = fInitialInput; *out_input = fInitialInput;
} else { } else {
out_input = GetInput(*cookie); out_input = GetInput(*cookie);

View File

@ -12,6 +12,9 @@
#include "VideoMixerNode.h" #include "VideoMixerNode.h"
#include <stdio.h>
// -------------------------------------------------------- // // -------------------------------------------------------- //
// implementation for BMediaEventLooper // implementation for BMediaEventLooper
// -------------------------------------------------------- // // -------------------------------------------------------- //
@ -19,7 +22,7 @@
void VideoMixerNode::HandleEvent( void VideoMixerNode::HandleEvent(
const media_timed_event *event, const media_timed_event *event,
bigtime_t lateness, bigtime_t lateness,
bool realTimeEvent = false) bool realTimeEvent)
{ {
switch (event->type) { switch (event->type) {
case BTimedEventQueue::B_START: case BTimedEventQueue::B_START:
@ -80,7 +83,7 @@ void VideoMixerNode::ControlLoop() {
status_t VideoMixerNode::HandleStart( status_t VideoMixerNode::HandleStart(
const media_timed_event *event, const media_timed_event *event,
bigtime_t lateness, bigtime_t lateness,
bool realTimeEvent = false) bool realTimeEvent)
{ {
fprintf(stderr,"VideoMixerNode(BMediaEventLooper)::HandleStart()\n"); fprintf(stderr,"VideoMixerNode(BMediaEventLooper)::HandleStart()\n");
if (RunState() != B_STARTED) { if (RunState() != B_STARTED) {
@ -94,7 +97,7 @@ status_t VideoMixerNode::HandleStart(
status_t VideoMixerNode::HandleSeek( status_t VideoMixerNode::HandleSeek(
const media_timed_event *event, const media_timed_event *event,
bigtime_t lateness, bigtime_t lateness,
bool realTimeEvent = false) bool realTimeEvent)
{ {
fprintf(stderr,"VideoMixerNode(BMediaEventLooper)::HandleSeek(t=%lld,d=%ld,bd=%lld)\n",event->event_time, event->data, event->bigdata); fprintf(stderr,"VideoMixerNode(BMediaEventLooper)::HandleSeek(t=%lld,d=%ld,bd=%lld)\n",event->event_time, event->data, event->bigdata);
return B_OK; return B_OK;
@ -103,7 +106,7 @@ status_t VideoMixerNode::HandleSeek(
status_t VideoMixerNode::HandleWarp( status_t VideoMixerNode::HandleWarp(
const media_timed_event *event, const media_timed_event *event,
bigtime_t lateness, bigtime_t lateness,
bool realTimeEvent = false) bool realTimeEvent)
{ {
fprintf(stderr,"VideoMixerNode(BMediaEventLooper)::HandleWarp\n"); fprintf(stderr,"VideoMixerNode(BMediaEventLooper)::HandleWarp\n");
return B_OK; return B_OK;
@ -112,7 +115,7 @@ status_t VideoMixerNode::HandleWarp(
status_t VideoMixerNode::HandleStop( status_t VideoMixerNode::HandleStop(
const media_timed_event *event, const media_timed_event *event,
bigtime_t lateness, bigtime_t lateness,
bool realTimeEvent = false) bool realTimeEvent)
{ {
fprintf(stderr,"VideoMixerNode(BMediaEventLooper)::HandleStop\n"); fprintf(stderr,"VideoMixerNode(BMediaEventLooper)::HandleStop\n");
// flush the queue so downstreamers don't get any more // flush the queue so downstreamers don't get any more
@ -123,7 +126,7 @@ status_t VideoMixerNode::HandleStop(
status_t VideoMixerNode::HandleBuffer( status_t VideoMixerNode::HandleBuffer(
const media_timed_event *event, const media_timed_event *event,
bigtime_t lateness, bigtime_t lateness,
bool realTimeEvent = false) bool realTimeEvent)
{ {
if (event->type != BTimedEventQueue::B_HANDLE_BUFFER) { if (event->type != BTimedEventQueue::B_HANDLE_BUFFER) {
fprintf(stderr,"HandleBuffer called on non buffer event type\n"); fprintf(stderr,"HandleBuffer called on non buffer event type\n");
@ -165,7 +168,7 @@ status_t VideoMixerNode::HandleBuffer(
status_t VideoMixerNode::HandleDataStatus( status_t VideoMixerNode::HandleDataStatus(
const media_timed_event *event, const media_timed_event *event,
bigtime_t lateness, bigtime_t lateness,
bool realTimeEvent = false) bool realTimeEvent)
{ {
fprintf(stderr,"VideoMixerNode(BMediaEventLooper)::HandleDataStatus"); fprintf(stderr,"VideoMixerNode(BMediaEventLooper)::HandleDataStatus");
SendDataStatus(event->data, fOutput.destination, event->event_time); SendDataStatus(event->data, fOutput.destination, event->event_time);
@ -175,7 +178,7 @@ status_t VideoMixerNode::HandleDataStatus(
status_t VideoMixerNode::HandleParameter( status_t VideoMixerNode::HandleParameter(
const media_timed_event *event, const media_timed_event *event,
bigtime_t lateness, bigtime_t lateness,
bool realTimeEvent = false) bool realTimeEvent)
{ {
fprintf(stderr,"VideoMixerNode(BMediaEventLooper)::HandleParameter"); fprintf(stderr,"VideoMixerNode(BMediaEventLooper)::HandleParameter");
return B_OK; return B_OK;

View File

@ -12,6 +12,10 @@
#include "VideoMixerNode.h" #include "VideoMixerNode.h"
#include <stdio.h>
#include <string.h>
// -------------------------------------------------------- // // -------------------------------------------------------- //
// implemention of BBufferProducer // implemention of BBufferProducer
// -------------------------------------------------------- // // -------------------------------------------------------- //

View File

@ -212,16 +212,16 @@ Const128 dw 128
dw 128 dw 128
; void Convert_YUV422_RGBA32_SSE2(void *fromPtr, void *toPtr, int width) ; void Convert_YUV422_RGBA32_SSE2(void *fromPtr, void *toPtr, int width)
width equ ebp+16 %define width ebp+16
toPtr equ ebp+12 %define toPtr ebp+12
fromPtr equ ebp+8 %define fromPtr ebp+8
; void Convert_YUV420P_RGBA32_SSE2(void *fromYPtr, void *fromUPtr, void *fromVPtr, void *toPtr, int width) ; void Convert_YUV420P_RGBA32_SSE2(void *fromYPtr, void *fromUPtr, void *fromVPtr, void *toPtr, int width)
width1 equ ebp+24 %define width1 ebp+24
toPtr1 equ ebp+20 %define toPtr1 ebp+20
fromVPtr equ ebp+16 %define fromVPtr ebp+16
fromUPtr equ ebp+12 %define fromUPtr ebp+12
fromYPtr equ ebp+8 %define fromYPtr ebp+8
SECTION .text align=16 SECTION .text align=16