2 * Copyright 1991-1999, Be Incorporated.
3 * Copyright (c) 1999-2000, Eric Moon.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions, and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 * notice, this list of conditions, and the following disclaimer in the
15 * documentation and/or other materials provided with the distribution.
17 * 3. The name of the author may not be used to endorse or promote products
18 * derived from this software without specific prior written permission.
20 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
21 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
24 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
28 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33 // LoggingConsumerAddOn.cpp
36 #include "LoggingConsumer.h"
37 #include "LoggingConsumerAddOn.h"
44 const char* const g_pLogPath
= "/tmp/node_log";
47 // instantiation function
48 extern "C" _EXPORT BMediaAddOn
* make_media_addon(image_id image
) {
49 return new LoggingConsumerAddOn(image
);
52 // -------------------------------------------------------- //
54 // -------------------------------------------------------- //
56 LoggingConsumerAddOn::~LoggingConsumerAddOn() {
57 PRINT(("~LoggingConsumerAddOn()\n"));
59 LoggingConsumerAddOn::LoggingConsumerAddOn(image_id image
) :
62 // -------------------------------------------------------- //
64 // -------------------------------------------------------- //
66 status_t
LoggingConsumerAddOn::InitCheck(
67 const char** out_failure_text
) {
71 int32
LoggingConsumerAddOn::CountFlavors() {
75 status_t
LoggingConsumerAddOn::GetFlavorAt(
77 const flavor_info
** out_info
) {
81 flavor_info
* pInfo
= new flavor_info
;
82 pInfo
->internal_id
= n
;
83 pInfo
->name
= (char*)"LoggingConsumer";
84 pInfo
->info
= (char*)"An add-on version of the LoggingConsumer node.\n"
85 "See the Be Developer Newsletter III.18: 5 May, 1999\n"
86 "adapted by Eric Moon (4 June, 1999)";
87 pInfo
->kinds
= B_BUFFER_CONSUMER
| B_CONTROLLABLE
;
88 pInfo
->flavor_flags
= 0;
89 pInfo
->possible_count
= 0;
91 pInfo
->in_format_count
= 1;
92 media_format
* pFormat
= new media_format
;
93 pFormat
->type
= B_MEDIA_UNKNOWN_TYPE
;
94 pInfo
->in_formats
= pFormat
;
96 pInfo
->out_format_count
= 0;
97 pInfo
->out_formats
= 0;
104 BMediaNode
* LoggingConsumerAddOn::InstantiateNodeFor(
105 const flavor_info
* info
,
107 status_t
* out_error
) {
109 // initialize log file
111 get_ref_for_path(g_pLogPath
, &ref
);
112 LoggingConsumer
* pNode
= new LoggingConsumer(ref
, this);
114 // trim down the log's verbosity a touch
115 pNode
->SetEnabled(LOG_HANDLE_EVENT
, false);
120 status_t
LoggingConsumerAddOn::GetConfigurationFor(
121 BMediaNode
* your_node
,
122 BMessage
* into_message
) {
128 // END -- LoggingConsumerAddOn.cpp