23#ifdef WITH_AMIGA_DATATYPES
28#include <proto/datatypes.h>
30#include <proto/intuition.h>
31#include <datatypes/soundclass.h>
32#include <intuition/classusr.h>
47typedef struct amiga_dt_sound_content {
52} amiga_dt_sound_content;
58static bool amiga_dt_sound_convert(
struct content *c);
59static void amiga_dt_sound_destroy(
struct content *c);
60static bool amiga_dt_sound_redraw(
struct content *c,
69 .
create = amiga_dt_sound_create,
70 .data_complete = amiga_dt_sound_convert,
71 .destroy = amiga_dt_sound_destroy,
72 .redraw = amiga_dt_sound_redraw,
73 .open = amiga_dt_sound_open,
74 .clone = amiga_dt_sound_clone,
75 .type = amiga_dt_sound_content_type,
80static void amiga_dt_sound_play(Object *dto)
82 NSLOG(netsurf, INFO,
"Playing...");
83 IDoMethod(dto, DTM_TRIGGER, NULL, STM_PLAY, NULL);
87nserror amiga_dt_sound_init(
void)
89 struct DataType *dt, *prevdt = NULL;
92 struct Node *node = NULL;
94 while((dt = ObtainDataType(DTST_RAM, NULL,
96 DTA_GroupID, GID_SOUND,
99 ReleaseDataType(prevdt);
108 lwc_string_data(
type),
109 &amiga_dt_sound_content_handler);
115 }
while (node != NULL);
119 ReleaseDataType(prevdt);
127 bool quirks,
struct content **c)
129 amiga_dt_sound_content *plugin;
132 NSLOG(netsurf, INFO,
"amiga_dt_sound_create");
134 plugin = calloc(1,
sizeof(amiga_dt_sound_content));
138 error =
content__init(&plugin->base, handler, imime_type, params,
139 llcache, fallback_charset, quirks);
145 *c = (
struct content *) plugin;
150bool amiga_dt_sound_convert(
struct content *c)
152 NSLOG(netsurf, INFO,
"amiga_dt_sound_convert");
154 amiga_dt_sound_content *plugin = (amiga_dt_sound_content *) c;
161 plugin->dto = NewDTObject(NULL,
162 DTA_SourceType, DTST_MEMORY,
163 DTA_SourceAddress, data,
164 DTA_SourceSize,
size,
165 DTA_GroupID, GID_SOUND,
168 if(plugin->dto == NULL)
return false;
173 if(plugin->immediate ==
true) amiga_dt_sound_play(plugin->dto);
182void amiga_dt_sound_destroy(
struct content *c)
184 amiga_dt_sound_content *plugin = (amiga_dt_sound_content *) c;
186 NSLOG(netsurf, INFO,
"amiga_dt_sound_destroy");
188 DisposeDTObject(plugin->dto);
193bool amiga_dt_sound_redraw(
struct content *c,
199 .fill_colour = 0xffffff,
200 .stroke_colour = 0x000000,
205 NSLOG(netsurf, INFO,
"amiga_dt_sound_redraw");
229 amiga_dt_sound_content *plugin = (amiga_dt_sound_content *) c;
232 NSLOG(netsurf, INFO,
"amiga_dt_sound_open");
234 plugin->immediate =
false;
236 if(params && (param = params->
params))
240 NSLOG(netsurf, INFO,
"%s = %s", param->
name,
242 if((strcmp(param->
name,
"autoplay") == 0) &&
243 (strcmp(param->
value,
"true") == 0)) plugin->immediate =
true;
244 if((strcmp(param->
name,
"autoStart") == 0) &&
245 (strcmp(param->
value,
"1") == 0)) plugin->immediate =
true;
247 }
while(param != NULL);
250 if(plugin->dto && (plugin->immediate ==
true))
251 amiga_dt_sound_play(plugin->dto);
259 amiga_dt_sound_content *plugin;
262 NSLOG(netsurf, INFO,
"amiga_dt_sound_clone");
264 plugin = calloc(1,
sizeof(amiga_dt_sound_content));
277 if (amiga_dt_sound_convert(&plugin->base) ==
false) {
283 *newc = (
struct content *) plugin;
struct Node * ami_mime_from_datatype(struct DataType *dt, lwc_string **mimetype, struct Node *start_node)
Return a MIME Type matching a DataType.
void content_destroy(struct content *c)
Destroy and free a content.
lwc_string * content__get_mime_type(struct content *c)
Retrieve mime-type of content.
void content_set_done(struct content *c)
Put a content in status CONTENT_STATUS_DONE.
nserror content__init(struct content *c, const content_handler *handler, lwc_string *imime_type, const struct http_parameter *params, llcache_handle *llcache, const char *fallback_charset, bool quirks)
const uint8_t * content__get_source_data(struct content *c, size_t *size)
Retrieve source of content.
nserror content__clone(const struct content *c, struct content *nc)
Clone a content's data members.
void content_set_ready(struct content *c)
Put a content in status CONTENT_STATUS_READY and unlock the content.
void content_set_status(struct content *c, const char *status_message)
Updates content with new status.
nserror content_factory_register_handler(const char *mime_type, const content_handler *handler)
Register a handler with the content factory.
Protected interface to Content handling.
@ CONTENT_STATUS_READY
Some parts of content still being loaded, but can be displayed.
@ CONTENT_STATUS_DONE
Content has completed all processing.
content_type
The type of a content.
@ CONTENT_PLUGIN
Navigator API Plugins.
nserror
Enumeration of error codes.
@ NSERROR_NOMEM
Memory exhaustion.
@ NSERROR_CLONE_FAILED
Failed to clone handle.
Public content interface.
Target independent plotting interface.
static struct llcache_s * llcache
low level cache state
Low-level resource cache (interface)
#define NSLOG(catname, level, logmsg, args...)
Localised message support (interface).
Minimal compatibility header for AmigaOS 3.
plot_font_style_t const *const plot_style_font
#define plot_style_int_to_fixed(v)
@ PLOT_OP_TYPE_SOLID
Solid colour.
Interface to utility string handling.
Content operation function table.
nserror(* create)(const struct content_handler *handler, lwc_string *imime_type, const struct http_parameter *params, struct llcache_handle *llcache, const char *fallback_charset, bool quirks, struct content **c)
parameters to content redraw
int height
vertical dimension
int y
coordinate for top-left of redraw
int x
coordinate for top-left of redraw
int width
dimensions to render content at (for scaling contents with intrinsic dimensions)
Content which corresponds to a single URL.
bool quirks
Content is in quirks mode.
int height
Height dimension, if applicable.
char * fallback_charset
Fallback charset, or NULL.
int width
Width dimension, if applicable.
const struct content_handler * handler
Handler for content.
content_status status
Current status.
unsigned int size
Estimated size of all data associated with this content.
Representation of an HTTP parameter.
Handle to low-level cache object.
Linked list of object element parameters.
struct object_param * next
Parameters for object element and similar elements.
struct object_param * params
Plot style for stroke/fill plotters.
plot_operation_type_t fill_type
Fill plot type.
nserror(* text)(const struct redraw_context *ctx, const plot_font_style_t *fstyle, int x, int y, const char *text, size_t length)
Text plotting.
nserror(* rectangle)(const struct redraw_context *ctx, const plot_style_t *pstyle, const struct rect *rectangle)
Plots a rectangle.
const struct plotter_table * plot
Current plot operation table.
static nserror clip(const struct redraw_context *ctx, const struct rect *clip)
Sets a clip rectangle for subsequent plot operations.