NodeTest: Add GetNodeAttributesFor test
This commit is contained in:
parent
c079d8d6d9
commit
fb6c8a0479
@ -4,6 +4,7 @@
|
||||
|
||||
#include <Buffer.h>
|
||||
#include <BufferGroup.h>
|
||||
#include <MediaNode.h>
|
||||
#include <TimeSource.h>
|
||||
|
||||
#include "misc.h"
|
||||
@ -45,6 +46,19 @@ ProducerNode::NodeRegistered()
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
ProducerNode::GetNodeAttributes(
|
||||
media_node_attribute* attributes, size_t count)
|
||||
{
|
||||
uint32 what = media_node_attribute::B_FIRST_USER_ATTRIBUTE;
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
attributes[i].what = what;
|
||||
what++;
|
||||
}
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
ProducerNode::FormatSuggestionRequested(media_type type, int32 quality,
|
||||
media_format* format)
|
||||
|
@ -15,6 +15,10 @@ virtual BMediaAddOn* AddOn(
|
||||
|
||||
virtual void NodeRegistered();
|
||||
|
||||
virtual status_t GetNodeAttributes(
|
||||
media_node_attribute* attributes,
|
||||
size_t count);
|
||||
|
||||
/* functionality of BBufferProducer */
|
||||
virtual status_t FormatSuggestionRequested(
|
||||
media_type type,
|
||||
@ -84,9 +88,10 @@ virtual void LatencyChanged(
|
||||
uint32 flags);
|
||||
|
||||
/* functionality of BMediaEventLooper */
|
||||
virtual void HandleEvent(const media_timed_event *event,
|
||||
bigtime_t lateness,
|
||||
bool realTimeEvent = false);
|
||||
virtual void HandleEvent(
|
||||
const media_timed_event *event,
|
||||
bigtime_t lateness,
|
||||
bool realTimeEvent = false);
|
||||
|
||||
/* our own functionality */
|
||||
void InitializeOutput();
|
||||
|
@ -1,10 +1,14 @@
|
||||
#include <string.h>
|
||||
#include <Application.h>
|
||||
#include <MediaDefs.h>
|
||||
#include <MediaRoster.h>
|
||||
#include <TimeSource.h>
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "ConsumerNode.h"
|
||||
#include "ProducerNode.h"
|
||||
#include "misc.h"
|
||||
#include "ProducerNode.h"
|
||||
|
||||
|
||||
BMediaRoster *roster;
|
||||
ProducerNode *producer;
|
||||
@ -172,6 +176,12 @@ int main()
|
||||
val(rv);
|
||||
out("Found %ld\n",count);
|
||||
|
||||
out("Calling GetAttNodeAttributesFor(source)\n");
|
||||
media_node_attribute attr[10];
|
||||
ssize_t size = roster->GetNodeAttributesFor(sourceNode, attr, 10);
|
||||
val_size(size);
|
||||
out("Found %" B_PRIdSSIZE "\n", size);
|
||||
|
||||
media_format format;
|
||||
format.type = B_MEDIA_RAW_AUDIO;
|
||||
format.u.raw_audio = media_raw_audio_format::wildcard;
|
||||
|
@ -13,10 +13,18 @@ void val(status_t status)
|
||||
{
|
||||
if (status == B_OK)
|
||||
out("OK\n");
|
||||
else
|
||||
else
|
||||
out("failed, 0x%08x, %s\n",status,strerror(status));
|
||||
}
|
||||
|
||||
void val_size(ssize_t size)
|
||||
{
|
||||
if (size >= 0)
|
||||
out("OK\n");
|
||||
else
|
||||
out("failed, size %" B_PRIdSSIZE ", error %s\n", size, strerror(size));
|
||||
}
|
||||
|
||||
void wait()
|
||||
{
|
||||
out("press enter to continue\n");
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
void val(void *p);
|
||||
void val(status_t status);
|
||||
void val_size(ssize_t size);
|
||||
|
||||
void wait();
|
||||
void out(const char *format,...);
|
||||
|
Loading…
Reference in New Issue
Block a user