Thread: [Redbutton-devel] SF.net SVN: redbutton: [221] redbutton-browser/trunk (Page 3)
Brought to you by:
skilvington
|
From: <ski...@us...> - 2007-02-16 21:58:41
|
Revision: 221
http://svn.sourceforge.net/redbutton/?rev=221&view=rev
Author: skilvington
Date: 2007-02-16 13:58:40 -0800 (Fri, 16 Feb 2007)
Log Message:
-----------
cope with MPEG stream type 6
Modified Paths:
--------------
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/TODO
redbutton-browser/trunk/mpegts.h
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2007-02-16 21:06:15 UTC (rev 220)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2007-02-16 21:58:40 UTC (rev 221)
@@ -221,7 +221,8 @@
p->video->inst.no_video = true;
/* is audio/video output totally disabled */
- if(MHEGEngine_avDisabled())
+ if(MHEGEngine_avDisabled()
+ || (!p->have_video && !p->have_audio))
return;
p->audio_pid = p->audio_tag;
@@ -242,6 +243,17 @@
p->stop = false;
/*
+ * the MPEG type for some streams is set to 6 (STREAM_TYPE_PRIVATE_DATA)
+ * eg the streams for BBC News Multiscreen
+ * presumably, this is stop them getting accidentally picked up when you scan for channels
+ * luckily we know what type MPEG audio and video streams should be
+ */
+ if(p->have_video && p->video_type == STREAM_TYPE_PRIVATE_DATA)
+ p->video_type = STREAM_TYPE_VIDEO_MPEG2;
+ if(p->have_audio && p->audio_type == STREAM_TYPE_PRIVATE_DATA)
+ p->audio_type = STREAM_TYPE_AUDIO_MPEG2;
+
+ /*
* we have three threads:
* decode_thread reads MPEG data from the TS and decodes it into YUV video frames and audio samples
* video_thread takes YUV frames off the videoq list, converts them to RGB and displays them on the screen
Modified: redbutton-browser/trunk/TODO
===================================================================
--- redbutton-browser/trunk/TODO 2007-02-16 21:06:15 UTC (rev 220)
+++ redbutton-browser/trunk/TODO 2007-02-16 21:58:40 UTC (rev 221)
@@ -1,4 +1,4 @@
-find out what MPEG stream type 6 means!
+VideoDecodeOffset
don't keep malloc/free'ing memory for a/v frames
Modified: redbutton-browser/trunk/mpegts.h
===================================================================
--- redbutton-browser/trunk/mpegts.h 2007-02-16 21:06:15 UTC (rev 220)
+++ redbutton-browser/trunk/mpegts.h 2007-02-16 21:58:40 UTC (rev 221)
@@ -6,15 +6,16 @@
#define __MPEGTS_H__
/* stream types we care about */
-#define STREAM_TYPE_VIDEO_MPEG1 0x01
-#define STREAM_TYPE_VIDEO_MPEG2 0x02
-#define STREAM_TYPE_AUDIO_MPEG1 0x03
-#define STREAM_TYPE_AUDIO_MPEG2 0x04
-#define STREAM_TYPE_AUDIO_AAC 0x0f
-#define STREAM_TYPE_VIDEO_MPEG4 0x10
-#define STREAM_TYPE_VIDEO_H264 0x1b
-#define STREAM_TYPE_AUDIO_AC3 0x81
-#define STREAM_TYPE_AUDIO_DTS 0x8a
+#define STREAM_TYPE_VIDEO_MPEG1 0x01
+#define STREAM_TYPE_VIDEO_MPEG2 0x02
+#define STREAM_TYPE_AUDIO_MPEG1 0x03
+#define STREAM_TYPE_AUDIO_MPEG2 0x04
+#define STREAM_TYPE_PRIVATE_DATA 0x06
+#define STREAM_TYPE_AUDIO_AAC 0x0f
+#define STREAM_TYPE_VIDEO_MPEG4 0x10
+#define STREAM_TYPE_VIDEO_H264 0x1b
+#define STREAM_TYPE_AUDIO_AC3 0x81
+#define STREAM_TYPE_AUDIO_DTS 0x8a
typedef struct MpegTSContext MpegTSContext;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-02-25 10:21:54
|
Revision: 229
http://svn.sourceforge.net/redbutton/?rev=229&view=rev
Author: skilvington
Date: 2007-02-25 02:21:50 -0800 (Sun, 25 Feb 2007)
Log Message:
-----------
don't keep malloc/free'ing memory for a/v frames
Modified Paths:
--------------
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/MHEGStreamPlayer.h
redbutton-browser/trunk/TODO
redbutton-browser/trunk/utils.c
redbutton-browser/trunk/utils.h
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2007-02-19 17:47:32 UTC (rev 228)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2007-02-25 10:21:50 UTC (rev 229)
@@ -23,12 +23,32 @@
static void thread_usleep(unsigned long);
static enum CodecID find_av_codec_id(int);
+/* global pool of spare VideoFrame's */
+LIST_OF(VideoFrame) *free_vframes = NULL;
+pthread_mutex_t free_vframes_lock = PTHREAD_MUTEX_INITIALIZER;
+
LIST_TYPE(VideoFrame) *
new_VideoFrameListItem(double pts, enum PixelFormat pix_fmt, unsigned int width, unsigned int height, AVFrame *frame)
{
- LIST_TYPE(VideoFrame) *vf = safe_malloc(sizeof(LIST_TYPE(VideoFrame)));
+ LIST_TYPE(VideoFrame) *vf;
int frame_size;
+ /* do we have a spare frame we can use */
+ pthread_mutex_lock(&free_vframes_lock);
+ if(free_vframes != NULL)
+ {
+ vf = free_vframes;
+ LIST_REMOVE(&free_vframes, vf);
+ }
+ else
+ {
+ vf = safe_malloc(sizeof(LIST_TYPE(VideoFrame)));
+ vf->item.frame_data = NULL;
+ vf->item.nalloced = 0;
+ }
+ pthread_mutex_unlock(&free_vframes_lock);
+
+ /* frame info */
vf->item.pts = pts;
vf->item.pix_fmt = pix_fmt;
vf->item.width = width;
@@ -40,7 +60,7 @@
*/
if((frame_size = avpicture_get_size(pix_fmt, width, height)) < 0)
fatal("Invalid frame_size");
- vf->item.frame_data = safe_malloc(frame_size);
+ vf->item.frame_data = safe_fast_realloc(vf->item.frame_data, &vf->item.nalloced, frame_size);
avpicture_fill(&vf->item.frame, vf->item.frame_data, pix_fmt, width, height);
img_copy(&vf->item.frame, (AVPicture*) frame, pix_fmt, width, height);
@@ -50,18 +70,36 @@
void
free_VideoFrameListItem(LIST_TYPE(VideoFrame) *vf)
{
- safe_free(vf->item.frame_data);
+ /* add it to the free list */
+ pthread_mutex_lock(&free_vframes_lock);
+ LIST_APPEND(&free_vframes, vf);
+ pthread_mutex_unlock(&free_vframes_lock);
- safe_free(vf);
-
return;
}
+/* global pool of spare AudioFrame's */
+LIST_OF(AudioFrame) *free_aframes = NULL;
+pthread_mutex_t free_aframes_lock = PTHREAD_MUTEX_INITIALIZER;
+
LIST_TYPE(AudioFrame) *
new_AudioFrameListItem(void)
{
- LIST_TYPE(AudioFrame) *af = safe_malloc(sizeof(LIST_TYPE(AudioFrame)));
+ LIST_TYPE(AudioFrame) *af;
+ /* do we have a spare frame we can use */
+ pthread_mutex_lock(&free_aframes_lock);
+ if(free_aframes != NULL)
+ {
+ af = free_aframes;
+ LIST_REMOVE(&free_aframes, af);
+ }
+ else
+ {
+ af = safe_malloc(sizeof(LIST_TYPE(AudioFrame)));
+ }
+ pthread_mutex_unlock(&free_aframes_lock);
+
af->item.pts = AV_NOPTS_VALUE;
af->item.size = 0;
@@ -72,7 +110,10 @@
void
free_AudioFrameListItem(LIST_TYPE(AudioFrame) *af)
{
- safe_free(af);
+ /* add it to the free list */
+ pthread_mutex_lock(&free_aframes_lock);
+ LIST_APPEND(&free_aframes, af);
+ pthread_mutex_unlock(&free_aframes_lock);
return;
}
Modified: redbutton-browser/trunk/MHEGStreamPlayer.h
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.h 2007-02-19 17:47:32 UTC (rev 228)
+++ redbutton-browser/trunk/MHEGStreamPlayer.h 2007-02-25 10:21:50 UTC (rev 229)
@@ -28,6 +28,7 @@
unsigned int height;
AVPicture frame;
unsigned char *frame_data;
+ size_t nalloced; /* number of bytes malloc'ed to frame_data */
} VideoFrame;
DEFINE_LIST_OF(VideoFrame);
Modified: redbutton-browser/trunk/TODO
===================================================================
--- redbutton-browser/trunk/TODO 2007-02-19 17:47:32 UTC (rev 228)
+++ redbutton-browser/trunk/TODO 2007-02-25 10:21:50 UTC (rev 229)
@@ -1,9 +1,6 @@
VideoDecodeOffset
-don't keep malloc/free'ing memory for a/v frames
-
-
if video size != VideoClass size, centre and draw a smaller transparent hole
Modified: redbutton-browser/trunk/utils.c
===================================================================
--- redbutton-browser/trunk/utils.c 2007-02-19 17:47:32 UTC (rev 228)
+++ redbutton-browser/trunk/utils.c 2007-02-25 10:21:50 UTC (rev 229)
@@ -188,6 +188,23 @@
}
/*
+ * only calls safe_realloc if nbytes > *oldsize
+ * updates *oldsize if it calls safe_realloc
+ */
+
+void *
+safe_fast_realloc(void *oldbuf, size_t *oldsize, size_t nbytes)
+{
+ if(nbytes > *oldsize)
+ {
+ oldbuf = safe_realloc(oldbuf, nbytes);
+ *oldsize = nbytes;
+ }
+
+ return oldbuf;
+}
+
+/*
* safe_free(NULL) is okay
*/
Modified: redbutton-browser/trunk/utils.h
===================================================================
--- redbutton-browser/trunk/utils.h 2007-02-19 17:47:32 UTC (rev 228)
+++ redbutton-browser/trunk/utils.h 2007-02-25 10:21:50 UTC (rev 229)
@@ -43,6 +43,7 @@
void *safe_malloc(size_t);
void *safe_mallocz(size_t);
void *safe_realloc(void *, size_t);
+void *safe_fast_realloc(void *, size_t *, size_t);
void safe_free(void *);
char *safe_strdup(const char *);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-02-26 16:08:01
|
Revision: 231
http://svn.sourceforge.net/redbutton/?rev=231&view=rev
Author: skilvington
Date: 2007-02-26 08:07:56 -0800 (Mon, 26 Feb 2007)
Log Message:
-----------
only demux the PIDs we are expecting
Modified Paths:
--------------
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/mpegts.c
redbutton-browser/trunk/mpegts.h
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2007-02-26 15:10:33 UTC (rev 230)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2007-02-26 16:07:56 UTC (rev 231)
@@ -362,6 +362,8 @@
decode_thread(void *arg)
{
MHEGStreamPlayer *p = (MHEGStreamPlayer *) arg;
+ int demux_apid;
+ int demux_vpid;
MpegTSContext *tsdemux;
AVPacket pkt;
AVCodecContext *audio_codec_ctx = NULL;
@@ -411,7 +413,9 @@
if((frame = avcodec_alloc_frame()) == NULL)
fatal("Out of memory");
- if((tsdemux = mpegts_open(p->ts)) == NULL)
+ demux_apid = p->have_audio ? p->audio_pid : -1;
+ demux_vpid = p->have_video ? p->video_pid : -1;
+ if((tsdemux = mpegts_open(p->ts, demux_apid, demux_vpid)) == NULL)
fatal("Out of memory");
while(!p->stop && !feof(p->ts))
Modified: redbutton-browser/trunk/mpegts.c
===================================================================
--- redbutton-browser/trunk/mpegts.c 2007-02-26 15:10:33 UTC (rev 230)
+++ redbutton-browser/trunk/mpegts.c 2007-02-26 16:07:56 UTC (rev 231)
@@ -37,22 +37,9 @@
#include "MHEGEngine.h"
#define TS_PACKET_SIZE 188
-#define NB_PID_MAX 2
/* expands as necessary */
#define INIT_FRAME_BUFF_SIZE (128 * 1024)
-typedef struct PESContext PESContext;
-
-struct MpegTSContext
-{
- FILE *ts_stream; /* transport stream we are reading from */
- AVPacket *pkt; /* packet containing av data */
- int stop_parse; /* stop parsing loop */
- PESContext *pids[NB_PID_MAX]; /* PIDs we are demuxing */
- int is_start; /* is the current packet the first of a frame */
- int last_cc; /* last Continuity Check value we saw (<0 => none seen yet) */
-};
-
/* TS stream handling */
enum MpegTSState
{
@@ -85,16 +72,38 @@
unsigned int alloc_size; /* number of bytes malloc'ed to frame_data */
};
+typedef struct PESContext PESContext;
+
+struct MpegTSContext
+{
+ FILE *ts_stream; /* transport stream we are reading from */
+ int apid; /* audio PID we want, -1 => no audio */
+ int vpid; /* video PID we want, -1 => no video */
+ AVPacket *pkt; /* packet containing av data */
+ int stop_parse; /* stop parsing loop */
+ PESContext apes; /* audio PES we are demuxing */
+ PESContext vpes; /* video PES we are demuxing */
+ int is_start; /* is the current packet the first of a frame */
+ int last_cc; /* last Continuity Check value we saw (<0 => none seen yet) */
+};
+
static int read_packet(FILE *, uint8_t *);
static void handle_packet(MpegTSContext *, const uint8_t *);
-static PESContext *add_pes_stream(MpegTSContext *, int);
+static int init_pes_stream(MpegTSContext *, PESContext *, int);
+static void free_pes_stream(PESContext *);
+static PESContext *find_pes_stream(MpegTSContext *, int);
static void mpegts_push_data(PESContext *, const uint8_t *, int, int);
static int64_t get_pts(const uint8_t *);
/* my interface */
+/*
+ * demux the given audio and video PIDs from the transport stream
+ * if apid or vpid is -1, ignore it
+ */
+
MpegTSContext *
-mpegts_open(FILE *ts)
+mpegts_open(FILE *ts, int apid, int vpid)
{
MpegTSContext *ctx;
@@ -102,7 +111,21 @@
return NULL;
ctx->ts_stream = ts;
+ ctx->apid = apid;
+ ctx->vpid = vpid;
+ if(init_pes_stream(ctx, &ctx->apes, apid) < 0)
+ {
+ av_free(ctx);
+ return NULL;
+ }
+ if(init_pes_stream(ctx, &ctx->vpes, vpid) < 0)
+ {
+ free_pes_stream(&ctx->apes);
+ av_free(ctx);
+ return NULL;
+ }
+
ctx->is_start = 0;
/* last continuity check value (-1 => CC always passes) */
@@ -126,8 +149,8 @@
return -1;
}
/* find the stream */
- if((pes = add_pes_stream(ctx, packet.stream_index)) == NULL)
- fatal("mpegts_demux_frame: internal error");
+ if((pes = find_pes_stream(ctx, packet.stream_index)) == NULL)
+ fatal("mpegts_demux_frame: unexpected PID %d", packet.stream_index);
/* is it the first packet of the next frame */
if(ctx->is_start == 0)
{
@@ -211,16 +234,9 @@
void
mpegts_close(MpegTSContext *ctx)
{
- int i;
+ free_pes_stream(&ctx->apes);
+ free_pes_stream(&ctx->vpes);
- for(i=0; i<NB_PID_MAX; i++)
- {
- if(ctx->pids[i])
- {
- av_free(ctx->pids[i]->frame_data);
- av_free(ctx->pids[i]);
- }
- }
av_free(ctx);
return;
@@ -276,8 +292,11 @@
pid = ((packet[1] & 0x1f) << 8) | packet[2];
- if((pes = add_pes_stream(ctx, pid)) == NULL)
+ if((pes = find_pes_stream(ctx, pid)) == NULL)
+ {
+ verbose("MPEG TS demux: ignoring unexpected PID %d", pid);
return;
+ }
ctx->is_start = packet[1] & 0x40;
@@ -311,40 +330,44 @@
return;
}
-static PESContext *
-add_pes_stream(MpegTSContext *ctx, int pid)
+static int
+init_pes_stream(MpegTSContext *ctx, PESContext *pes, int pid)
{
- PESContext *pes;
- int i;
+ bzero(pes, sizeof(PESContext));
- /* have we already added this PID */
- for(i=0; i<NB_PID_MAX && ctx->pids[i]!=NULL; i++)
- if(ctx->pids[i]->pid == pid)
- return ctx->pids[i];
- if(i == NB_PID_MAX)
- return NULL;
-
- /* if no pid found, then add a pid context */
- if((pes = av_mallocz(sizeof(PESContext))) == NULL)
- return NULL;
pes->ts = ctx;
pes->pid = pid;
pes->alloc_size = INIT_FRAME_BUFF_SIZE;
if((pes->frame_data = av_malloc(pes->alloc_size)) == NULL)
- {
- av_free(pes);
- return NULL;
- }
+ return -1;
pes->frame_pts = AV_NOPTS_VALUE;
pes->frame_dts = AV_NOPTS_VALUE;
- ctx->pids[i] = pes;
+ return 0;
+}
- return pes;
+static void
+free_pes_stream(PESContext *pes)
+{
+ if(pes->frame_data)
+ av_free(pes->frame_data);
+
+ return;
}
+static PESContext *
+find_pes_stream(MpegTSContext *ctx, int pid)
+{
+ if(pid == ctx->apid)
+ return &ctx->apes;
+ else if(pid == ctx->vpid)
+ return &ctx->vpes;
+ else
+ return NULL;
+}
+
/* return non zero if a packet could be constructed */
static void
mpegts_push_data(PESContext *pes, const uint8_t *buf, int buf_size, int is_start)
Modified: redbutton-browser/trunk/mpegts.h
===================================================================
--- redbutton-browser/trunk/mpegts.h 2007-02-26 15:10:33 UTC (rev 230)
+++ redbutton-browser/trunk/mpegts.h 2007-02-26 16:07:56 UTC (rev 231)
@@ -19,7 +19,7 @@
typedef struct MpegTSContext MpegTSContext;
-MpegTSContext *mpegts_open(FILE *);
+MpegTSContext *mpegts_open(FILE *, int, int);
int mpegts_demux_frame(MpegTSContext *, AVPacket *);
int mpegts_demux_packet(MpegTSContext *, AVPacket *);
void mpegts_close(MpegTSContext *);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-01 12:09:48
|
Revision: 232
http://svn.sourceforge.net/redbutton/?rev=232&view=rev
Author: skilvington
Date: 2007-03-01 04:09:42 -0800 (Thu, 01 Mar 2007)
Log Message:
-----------
centre video within its VideoClass
Modified Paths:
--------------
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/TODO
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2007-02-26 16:07:56 UTC (rev 231)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2007-03-01 12:09:42 UTC (rev 232)
@@ -512,6 +512,8 @@
int out_y;
unsigned int out_width;
unsigned int out_height;
+ unsigned int vid_width;
+ unsigned int vid_height;
VideoFrame *vf;
double buffered;
double last_pts;
@@ -650,17 +652,24 @@
if(p->have_audio)
set_avsync_base(p, last_pts, last_time);
}
- /* origin of VideoClass */
+ /* origin and size of VideoClass */
pthread_mutex_lock(&p->video->inst.bbox_lock);
out_x = p->video->inst.Position.x_position;
out_y = p->video->inst.Position.y_position;
+ vid_width = p->video->inst.BoxSize.x_length;
+ vid_height = p->video->inst.BoxSize.y_length;
pthread_mutex_unlock(&p->video->inst.bbox_lock);
/* scale if fullscreen */
if(d->fullscreen)
{
out_x = (out_x * d->xres) / MHEG_XRES;
out_y = (out_y * d->yres) / MHEG_YRES;
+ vid_width = (vid_width * d->xres) / MHEG_XRES;
+ vid_height = (vid_height * d->yres) / MHEG_YRES;
}
+ /* if the frame is smaller or larger than the VideoClass, centre it */
+ out_x += (vid_width - out_width) / 2;
+ out_y += (vid_height - out_height) / 2;
/* draw the current frame */
MHEGVideoOutput_drawFrame(&vo, out_x, out_y);
/* redraw objects above the video */
Modified: redbutton-browser/trunk/TODO
===================================================================
--- redbutton-browser/trunk/TODO 2007-02-26 16:07:56 UTC (rev 231)
+++ redbutton-browser/trunk/TODO 2007-03-01 12:09:42 UTC (rev 232)
@@ -1,7 +1,11 @@
+aspect ratio
+
+
VideoDecodeOffset
-if video size != VideoClass size, centre and draw a smaller transparent hole
+if video size != VideoClass size, draw a smaller transparent hole
+or fill the frame edges with black
clear overlay on boot/retune/launch/etc
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-01 17:26:43
|
Revision: 236
http://svn.sourceforge.net/redbutton/?rev=236&view=rev
Author: skilvington
Date: 2007-03-01 09:26:41 -0800 (Thu, 01 Mar 2007)
Log Message:
-----------
don't let timers go off after their GroupClass has been deleted
Modified Paths:
--------------
redbutton-browser/trunk/ApplicationClass.c
redbutton-browser/trunk/GroupClass.c
redbutton-browser/trunk/GroupClass.h
redbutton-browser/trunk/MHEGTimer.h
redbutton-browser/trunk/SceneClass.c
redbutton-browser/trunk/add_instance_vars.conf
Modified: redbutton-browser/trunk/ApplicationClass.c
===================================================================
--- redbutton-browser/trunk/ApplicationClass.c 2007-03-01 15:50:35 UTC (rev 235)
+++ redbutton-browser/trunk/ApplicationClass.c 2007-03-01 17:26:41 UTC (rev 236)
@@ -45,6 +45,7 @@
/* GroupClass */
v->GroupCachePriority = t->original_group_cache_priority;
v->Timers = NULL;
+ v->removed_timers = NULL;
/* ApplicationClass */
v->LockCount = 0;
@@ -58,7 +59,7 @@
void
free_ApplicationClassInstanceVars(ApplicationClassInstanceVars *v)
{
- GroupClass_freeTimers(&v->Timers);
+ GroupClass_freeTimers(&v->Timers, &v->removed_timers);
LIST_FREE(&v->DisplayStack, RootClassPtr, safe_free);
@@ -586,7 +587,7 @@
{
verbose("ApplicationClass: %s; SetTimer", ExternalReference_name(&t->rootClass.inst.ref));
- GroupClass_SetTimer(&t->rootClass.inst.ref, &t->inst.Timers, &t->inst.start_time, params, caller_gid);
+ GroupClass_SetTimer(&t->rootClass.inst.ref, &t->inst.Timers, &t->inst.removed_timers, &t->inst.start_time, params, caller_gid);
return;
}
Modified: redbutton-browser/trunk/GroupClass.c
===================================================================
--- redbutton-browser/trunk/GroupClass.c 2007-03-01 15:50:35 UTC (rev 235)
+++ redbutton-browser/trunk/GroupClass.c 2007-03-01 17:26:41 UTC (rev 236)
@@ -12,11 +12,12 @@
#include "ExternalReference.h"
void
-GroupClass_SetTimer(ExternalReference *ref, LIST_OF(Timer) **timer_list, struct timeval *start_time,
- SetTimer *params, OctetString *caller_gid)
+GroupClass_SetTimer(ExternalReference *ref, LIST_OF(Timer) **timer_list, LIST_OF(MHEGTimer) **removed_timers,
+ struct timeval *start_time, SetTimer *params, OctetString *caller_gid)
{
int id;
LIST_TYPE(Timer) *timer;
+ LIST_TYPE(MHEGTimer) *old_timer;
int value;
bool absolute;
int interval;
@@ -51,6 +52,13 @@
if(interval < 0)
interval = 0;
timer->item.position = value;
+ /*
+ * don't want timers going off after the GroupClass has been deleted
+ * so, remember the old mheg_id
+ */
+ old_timer = safe_malloc(sizeof(LIST_TYPE(MHEGTimer)));
+ old_timer->item = timer->item.mheg_id;
+ LIST_APPEND(removed_timers, old_timer);
/* update its mheg_id */
timer->item.mheg_id = MHEGTimer_addGroupClassTimer(interval, ref, timer->item.id, timer_list);
}
@@ -87,6 +95,10 @@
/* no new timer value => remove the timer */
if(timer != NULL)
{
+ /* remember the old mheg_id */
+ old_timer = safe_malloc(sizeof(LIST_TYPE(MHEGTimer)));
+ old_timer->item = timer->item.mheg_id;
+ LIST_APPEND(removed_timers, old_timer);
/* removing a timer does not surpress events from the previous timer */
LIST_REMOVE(timer_list, timer);
safe_free(timer);
@@ -129,9 +141,10 @@
}
void
-GroupClass_freeTimers(LIST_OF(Timer) **timer_list)
+GroupClass_freeTimers(LIST_OF(Timer) **timer_list, LIST_OF(MHEGTimer) **removed_timers)
{
LIST_TYPE(Timer) *timer = *timer_list;
+ LIST_TYPE(MHEGTimer) *old_timer = *removed_timers;
while(timer)
{
@@ -141,6 +154,15 @@
LIST_FREE(timer_list, Timer, safe_free);
+ /* remove the timers that have been updated or removed */
+ while(old_timer)
+ {
+ MHEGTimer_removeGroupClassTimer(old_timer->item);
+ old_timer = old_timer->next;
+ }
+
+ LIST_FREE(removed_timers, MHEGTimer, safe_free);
+
return;
}
Modified: redbutton-browser/trunk/GroupClass.h
===================================================================
--- redbutton-browser/trunk/GroupClass.h 2007-03-01 15:50:35 UTC (rev 235)
+++ redbutton-browser/trunk/GroupClass.h 2007-03-01 17:26:41 UTC (rev 236)
@@ -9,10 +9,10 @@
#include "ISO13522-MHEG-5.h"
-void GroupClass_SetTimer(ExternalReference *, LIST_OF(Timer) **, struct timeval *, SetTimer *, OctetString *);
+void GroupClass_SetTimer(ExternalReference *, LIST_OF(Timer) **, LIST_OF(MHEGTimer) **, struct timeval *, SetTimer *, OctetString *);
void GroupClass_timerFired(ExternalReference *, int, MHEGTimer, LIST_OF(Timer) **);
-void GroupClass_freeTimers(LIST_OF(Timer) **);
+void GroupClass_freeTimers(LIST_OF(Timer) **, LIST_OF(MHEGTimer) **);
#endif /* __GROUPCLASS_H__ */
Modified: redbutton-browser/trunk/MHEGTimer.h
===================================================================
--- redbutton-browser/trunk/MHEGTimer.h 2007-03-01 15:50:35 UTC (rev 235)
+++ redbutton-browser/trunk/MHEGTimer.h 2007-03-01 17:26:41 UTC (rev 236)
@@ -10,6 +10,8 @@
typedef XtIntervalId MHEGTimer;
+DEFINE_LIST_OF(MHEGTimer);
+
MHEGTimer MHEGTimer_addGroupClassTimer(unsigned int, ExternalReference *, int, void *);
void MHEGTimer_removeGroupClassTimer(MHEGTimer);
Modified: redbutton-browser/trunk/SceneClass.c
===================================================================
--- redbutton-browser/trunk/SceneClass.c 2007-03-01 15:50:35 UTC (rev 235)
+++ redbutton-browser/trunk/SceneClass.c 2007-03-01 17:26:41 UTC (rev 236)
@@ -23,6 +23,7 @@
/* GroupClass */
v->GroupCachePriority = t->original_group_cache_priority;
v->Timers = NULL;
+ v->removed_timers = NULL;
v->next_clone = FIRST_CLONED_OBJ_NUM;
@@ -32,7 +33,7 @@
void
free_SceneClassInstanceVars(SceneClassInstanceVars *v)
{
- GroupClass_freeTimers(&v->Timers);
+ GroupClass_freeTimers(&v->Timers, &v->removed_timers);
return;
}
@@ -210,7 +211,7 @@
{
verbose("SceneClass: %s; SetTimer", ExternalReference_name(&t->rootClass.inst.ref));
- GroupClass_SetTimer(&t->rootClass.inst.ref, &t->inst.Timers, &t->inst.start_time, params, caller_gid);
+ GroupClass_SetTimer(&t->rootClass.inst.ref, &t->inst.Timers, &t->inst.removed_timers, &t->inst.start_time, params, caller_gid);
return;
}
Modified: redbutton-browser/trunk/add_instance_vars.conf
===================================================================
--- redbutton-browser/trunk/add_instance_vars.conf 2007-03-01 15:50:35 UTC (rev 235)
+++ redbutton-browser/trunk/add_instance_vars.conf 2007-03-01 17:26:41 UTC (rev 236)
@@ -40,7 +40,8 @@
/* inherited from GroupClass */
unsigned int GroupCachePriority;
LIST_OF(Timer) *Timers;
- /* we add this */
+ /* we add these */
+ LIST_OF(MHEGTimer) *removed_timers;
struct timeval start_time;
/* ApplicationClass */
unsigned int LockCount;
@@ -56,7 +57,8 @@
/* inherited from GroupClass */
unsigned int GroupCachePriority;
LIST_OF(Timer) *Timers;
- /* we add this */
+ /* we add these */
+ LIST_OF(MHEGTimer) *removed_timers;
struct timeval start_time;
/* we add where to start searching for unused object numbers for clones */
unsigned int next_clone;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-06 12:19:34
|
Revision: 238
http://svn.sourceforge.net/redbutton/?rev=238&view=rev
Author: skilvington
Date: 2007-03-06 04:19:18 -0800 (Tue, 06 Mar 2007)
Log Message:
-----------
DynamicLineArtClass Activation and Deactivation
Modified Paths:
--------------
redbutton-browser/trunk/DynamicLineArtClass.c
redbutton-browser/trunk/TODO
Modified: redbutton-browser/trunk/DynamicLineArtClass.c
===================================================================
--- redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-02 09:12:32 UTC (rev 237)
+++ redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-06 12:19:18 UTC (rev 238)
@@ -31,8 +31,21 @@
{
verbose("DynamicLineArtClass: %s; Activation", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_Activation not yet implemented\n");
+ /* has it been prepared yet */
+ if(!t->rootClass.inst.AvailabilityStatus)
+ DynamicLineArtClass_Preparation(t);
+
+ /* has it already been activated */
+ if(!RootClass_Activation(&t->rootClass))
+ return;
+
+ /* set its RunningStatus */
+ t->rootClass.inst.RunningStatus = true;
+ MHEGEngine_generateEvent(&t->rootClass.inst.ref, EventType_is_running, NULL);
+
+ /* now its RunningStatus is true, get it drawn at its position in the application's DisplayStack */
+ MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
+
return;
}
@@ -41,8 +54,13 @@
{
verbose("DynamicLineArtClass: %s; Deactivation", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_Deactivation not yet implemented\n");
+ /* is it already deactivated */
+ if(!RootClass_Deactivation(&t->rootClass))
+ return;
+
+ /* now its RunningStatus is false, redraw the area it covered */
+ MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
+
return;
}
@@ -101,6 +119,8 @@
{
verbose("DynamicLineArtClass: %s; SetPosition", ExternalReference_name(&t->rootClass.inst.ref));
+ /* corrigendum says we don't need to clear to OriginalRefFillColour */
+
/* TODO */
printf("TODO: DynamicLineArtClass_SetPosition not yet implemented\n");
return;
@@ -123,6 +143,7 @@
/* TODO */
printf("TODO: DynamicLineArtClass_SetBoxSize not yet implemented\n");
+/* clear to OriginalRefFillColour */
return;
}
@@ -143,8 +164,7 @@
MHEGEngine_bringToFront(&t->rootClass);
-/* TODO */
-/* clear to OriginalRefFillColour */
+ /* corrigendum says we don't need to clear to OriginalRefFillColour */
/* if it is active, redraw it */
if(t->rootClass.inst.RunningStatus)
@@ -160,8 +180,7 @@
MHEGEngine_sendToBack(&t->rootClass);
-/* TODO */
-/* clear to OriginalRefFillColour */
+ /* corrigendum says we don't need to clear to OriginalRefFillColour */
/* if it is active, redraw it */
if(t->rootClass.inst.RunningStatus)
@@ -182,8 +201,7 @@
&& ((obj = MHEGEngine_findObjectReference(ref, caller_gid)) != NULL))
{
MHEGEngine_putBefore(&t->rootClass, obj);
-/* TODO */
-/* clear to OriginalRefFillColour */
+ /* corrigendum says we don't need to clear to OriginalRefFillColour */
/* if it is active, redraw it */
if(t->rootClass.inst.RunningStatus)
MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
@@ -204,8 +222,7 @@
&& ((obj = MHEGEngine_findObjectReference(ref, caller_gid)) != NULL))
{
MHEGEngine_putBehind(&t->rootClass, obj);
-/* TODO */
-/* clear to OriginalRefFillColour */
+ /* corrigendum says we don't need to clear to OriginalRefFillColour */
/* if it is active, redraw it */
if(t->rootClass.inst.RunningStatus)
MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
Modified: redbutton-browser/trunk/TODO
===================================================================
--- redbutton-browser/trunk/TODO 2007-03-02 09:12:32 UTC (rev 237)
+++ redbutton-browser/trunk/TODO 2007-03-06 12:19:18 UTC (rev 238)
@@ -1,3 +1,6 @@
+BorderedBoundingBox
+
+
aspect ratio
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-07 17:11:39
|
Revision: 240
http://svn.sourceforge.net/redbutton/?rev=240&view=rev
Author: skilvington
Date: 2007-03-07 09:11:28 -0800 (Wed, 07 Mar 2007)
Log Message:
-----------
add MHEGCanvas offscreen drawing class
Modified Paths:
--------------
redbutton-browser/trunk/DynamicLineArtClass.c
redbutton-browser/trunk/LineArtClass.c
redbutton-browser/trunk/Makefile
redbutton-browser/trunk/add_instance_vars.conf
Added Paths:
-----------
redbutton-browser/trunk/MHEGCanvas.c
redbutton-browser/trunk/MHEGCanvas.h
Modified: redbutton-browser/trunk/DynamicLineArtClass.c
===================================================================
--- redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-06 17:05:36 UTC (rev 239)
+++ redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-07 17:11:28 UTC (rev 240)
@@ -24,6 +24,9 @@
default_LineArtClassInstanceVars(t, &t->inst);
+ /* offscreen canvas to draw on */
+ t->inst.canvas = new_MHEGCanvas(t->inst.BoxSize.x_length, t->inst.BoxSize.y_length);
+
/* add it to the DisplayStack of the active application */
MHEGEngine_addVisibleObject(&t->rootClass);
Modified: redbutton-browser/trunk/LineArtClass.c
===================================================================
--- redbutton-browser/trunk/LineArtClass.c 2007-03-06 17:05:36 UTC (rev 239)
+++ redbutton-browser/trunk/LineArtClass.c 2007-03-07 17:11:28 UTC (rev 240)
@@ -37,6 +37,9 @@
else
MHEGColour_transparent(&v->RefFillColour);
+ /* derived classes must init this if they want to use it */
+ v->canvas = NULL;
+
return;
}
@@ -46,6 +49,9 @@
if(v->have_PaletteRef)
free_ObjectReference(&v->PaletteRef);
+ if(v->canvas != NULL)
+ free_MHEGCanvas(v->canvas);
+
return;
}
Added: redbutton-browser/trunk/MHEGCanvas.c
===================================================================
--- redbutton-browser/trunk/MHEGCanvas.c (rev 0)
+++ redbutton-browser/trunk/MHEGCanvas.c 2007-03-07 17:11:28 UTC (rev 240)
@@ -0,0 +1,24 @@
+/*
+ * MHEGCanvas.c
+ */
+
+#include "MHEGCanvas.h"
+#include "utils.h"
+
+MHEGCanvas *
+new_MHEGCanvas(unsigned int width, unsigned int height)
+{
+ MHEGCanvas *c = safe_mallocz(sizeof(MHEGCanvas));
+
+/* TODO */
+printf("TODO: new_MHEGCanvas(%u, %u)\n", width, height);
+
+ return c;
+}
+
+void
+free_MHEGCanvas(MHEGCanvas *c)
+{
+ safe_free(c);
+}
+
Added: redbutton-browser/trunk/MHEGCanvas.h
===================================================================
--- redbutton-browser/trunk/MHEGCanvas.h (rev 0)
+++ redbutton-browser/trunk/MHEGCanvas.h 2007-03-07 17:11:28 UTC (rev 240)
@@ -0,0 +1,21 @@
+/*
+ * MHEGCanvas.h
+ */
+
+#ifndef __MHEGCANVAS_H__
+#define __MHEGCANVAS_H__
+
+#include <X11/Xlib.h>
+#include <X11/extensions/Xrender.h>
+
+typedef struct
+{
+ Pixmap contents; /* current image */
+ Picture contents_pic; /* XRender wrapper */
+} MHEGCanvas;
+
+MHEGCanvas *new_MHEGCanvas(unsigned int, unsigned int);
+void free_MHEGCanvas(MHEGCanvas *);
+
+#endif /* __MHEGCANVAS_H__ */
+
Modified: redbutton-browser/trunk/Makefile
===================================================================
--- redbutton-browser/trunk/Makefile 2007-03-06 17:05:36 UTC (rev 239)
+++ redbutton-browser/trunk/Makefile 2007-03-07 17:11:28 UTC (rev 240)
@@ -65,6 +65,7 @@
OBJS= rb-browser.o \
MHEGEngine.o \
MHEGDisplay.o \
+ MHEGCanvas.o \
MHEGBackend.o \
MHEGApp.o \
MHEGColour.o \
Modified: redbutton-browser/trunk/add_instance_vars.conf
===================================================================
--- redbutton-browser/trunk/add_instance_vars.conf 2007-03-06 17:05:36 UTC (rev 239)
+++ redbutton-browser/trunk/add_instance_vars.conf 2007-03-07 17:11:28 UTC (rev 240)
@@ -124,6 +124,7 @@
<LineArtClass>
#include "MHEGColour.h"
+#include "MHEGCanvas.h"
typedef struct
{
@@ -140,6 +141,8 @@
#define LineStyle_dotted original_line_style_dotted
MHEGColour RefLineColour;
MHEGColour RefFillColour;
+ /* only used by DynamicLineArtClass */
+ MHEGCanvas *canvas;
} LineArtClassInstanceVars;
</LineArtClass>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-09 16:40:53
|
Revision: 241
http://svn.sourceforge.net/redbutton/?rev=241&view=rev
Author: skilvington
Date: 2007-03-09 08:40:47 -0800 (Fri, 09 Mar 2007)
Log Message:
-----------
set initial border for DynamicLineArtClass
Modified Paths:
--------------
redbutton-browser/trunk/DynamicLineArtClass.c
redbutton-browser/trunk/LineArtClass.c
redbutton-browser/trunk/MHEGCanvas.c
redbutton-browser/trunk/MHEGCanvas.h
redbutton-browser/trunk/TODO
redbutton-browser/trunk/add_instance_vars.conf
Modified: redbutton-browser/trunk/DynamicLineArtClass.c
===================================================================
--- redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-07 17:11:28 UTC (rev 240)
+++ redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-09 16:40:47 UTC (rev 241)
@@ -27,6 +27,16 @@
/* offscreen canvas to draw on */
t->inst.canvas = new_MHEGCanvas(t->inst.BoxSize.x_length, t->inst.BoxSize.y_length);
+ /*
+ * default value for BorderedBoundingBox is true
+ * the border uses OriginalLineWidth/Style/Colour
+ * ie it can never change
+ */
+ if(!t->have_bordered_bounding_box || t->bordered_bounding_box)
+ MHEGCanvas_setBorder(t->inst.canvas, t->original_line_width, t->original_line_style, &t->inst.OriginalRefLineColour);
+ /* now we have set the border, clear the drawing area */
+ MHEGCanvas_clear(t->inst.canvas, &t->inst.OriginalRefFillColour);
+
/* add it to the DisplayStack of the active application */
MHEGEngine_addVisibleObject(&t->rootClass);
@@ -197,6 +207,7 @@
/* TODO */
/* clear to OriginalRefFillColour */
+/* dont forget to update the border */
printf("TODO: DynamicLineArtClass_SetBoxSize clear to OriginalRefFillColour\n");
/* if it is active, redraw it */
Modified: redbutton-browser/trunk/LineArtClass.c
===================================================================
--- redbutton-browser/trunk/LineArtClass.c 2007-03-07 17:11:28 UTC (rev 240)
+++ redbutton-browser/trunk/LineArtClass.c 2007-03-09 16:40:47 UTC (rev 241)
@@ -27,15 +27,19 @@
/* default colour is black */
if(t->have_original_ref_line_colour)
- MHEGColour_fromColour(&v->RefLineColour, &t->original_ref_line_colour);
+ MHEGColour_fromColour(&v->OriginalRefLineColour, &t->original_ref_line_colour);
else
- MHEGColour_black(&v->RefLineColour);
+ MHEGColour_black(&v->OriginalRefLineColour);
+ /* initial line colour */
+ memcpy(&v->RefLineColour, &v->OriginalRefLineColour, sizeof(MHEGColour));
/* default is transparent */
if(t->have_original_ref_fill_colour)
- MHEGColour_fromColour(&v->RefFillColour, &t->original_ref_fill_colour);
+ MHEGColour_fromColour(&v->OriginalRefFillColour, &t->original_ref_fill_colour);
else
- MHEGColour_transparent(&v->RefFillColour);
+ MHEGColour_transparent(&v->OriginalRefFillColour);
+ /* initial fill colour */
+ memcpy(&v->RefFillColour, &v->OriginalRefFillColour, sizeof(MHEGColour));
/* derived classes must init this if they want to use it */
v->canvas = NULL;
Modified: redbutton-browser/trunk/MHEGCanvas.c
===================================================================
--- redbutton-browser/trunk/MHEGCanvas.c 2007-03-07 17:11:28 UTC (rev 240)
+++ redbutton-browser/trunk/MHEGCanvas.c 2007-03-09 16:40:47 UTC (rev 241)
@@ -2,6 +2,7 @@
* MHEGCanvas.c
*/
+#include "ISO13522-MHEG-5.h"
#include "MHEGCanvas.h"
#include "utils.h"
@@ -22,3 +23,37 @@
safe_free(c);
}
+/*
+ * set a border, no drawing will be done in the border (apart from the border itself)
+ * width is in pixels
+ * style should be one of:
+ * original_line_style_solid
+ * original_line_style_dashed
+ * original_line_style_dotted
+ */
+
+void
+MHEGCanvas_setBorder(MHEGCanvas *c, int width, int style, MHEGColour *colour)
+{
+ if(width <= 0)
+ return;
+
+/* TODO */
+printf("TODO: MHEGCanvas_setBorder: width=%d style=%d RGBT=%02x%02x%02x%02x\n", width, style, colour->r, colour->g, colour->b, colour->t);
+
+ return;
+}
+
+/*
+ * fill the image (excluding the border) with the given colour
+ */
+
+void
+MHEGCanvas_clear(MHEGCanvas *c, MHEGColour *colour)
+{
+/* TODO */
+printf("TODO: MHEGCanvas_clear: RGBT=%02x%02x%02x%02x\n", colour->r, colour->g, colour->b, colour->t);
+
+ return;
+}
+
Modified: redbutton-browser/trunk/MHEGCanvas.h
===================================================================
--- redbutton-browser/trunk/MHEGCanvas.h 2007-03-07 17:11:28 UTC (rev 240)
+++ redbutton-browser/trunk/MHEGCanvas.h 2007-03-09 16:40:47 UTC (rev 241)
@@ -12,10 +12,15 @@
{
Pixmap contents; /* current image */
Picture contents_pic; /* XRender wrapper */
+ GC gc; /* contains the clip mask for the border */
} MHEGCanvas;
MHEGCanvas *new_MHEGCanvas(unsigned int, unsigned int);
void free_MHEGCanvas(MHEGCanvas *);
+void MHEGCanvas_setBorder(MHEGCanvas *, int, int, MHEGColour *);
+
+void MHEGCanvas_clear(MHEGCanvas *, MHEGColour *);
+
#endif /* __MHEGCANVAS_H__ */
Modified: redbutton-browser/trunk/TODO
===================================================================
--- redbutton-browser/trunk/TODO 2007-03-07 17:11:28 UTC (rev 240)
+++ redbutton-browser/trunk/TODO 2007-03-09 16:40:47 UTC (rev 241)
@@ -1,6 +1,3 @@
-BorderedBoundingBox
-
-
aspect ratio
Modified: redbutton-browser/trunk/add_instance_vars.conf
===================================================================
--- redbutton-browser/trunk/add_instance_vars.conf 2007-03-07 17:11:28 UTC (rev 240)
+++ redbutton-browser/trunk/add_instance_vars.conf 2007-03-09 16:40:47 UTC (rev 241)
@@ -141,6 +141,12 @@
#define LineStyle_dotted original_line_style_dotted
MHEGColour RefLineColour;
MHEGColour RefFillColour;
+ /*
+ * OriginalRefLine/FillColour are optional but have defaults defined in the spec
+ * store them here so we don't have to keep checking if they were specified or not
+ */
+ MHEGColour OriginalRefLineColour;
+ MHEGColour OriginalRefFillColour;
/* only used by DynamicLineArtClass */
MHEGCanvas *canvas;
} LineArtClassInstanceVars;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-12 17:08:36
|
Revision: 243
http://svn.sourceforge.net/redbutton/?rev=243&view=rev
Author: skilvington
Date: 2007-03-12 10:08:27 -0700 (Mon, 12 Mar 2007)
Log Message:
-----------
the easy DynamicLineArtClass methods
Modified Paths:
--------------
redbutton-browser/trunk/DynamicLineArtClass.c
redbutton-browser/trunk/MHEGCanvas.c
Modified: redbutton-browser/trunk/DynamicLineArtClass.c
===================================================================
--- redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-12 12:21:15 UTC (rev 242)
+++ redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-12 17:08:27 UTC (rev 243)
@@ -205,11 +205,19 @@
t->inst.BoxSize.x_length = GenericInteger_getInteger(¶ms->x_new_box_size, caller_gid);
t->inst.BoxSize.y_length = GenericInteger_getInteger(¶ms->y_new_box_size, caller_gid);
-/* TODO */
-/* clear to OriginalRefFillColour */
-/* dont forget to update the border */
-printf("TODO: DynamicLineArtClass_SetBoxSize clear to OriginalRefFillColour\n");
+ /* spec says we should fill the drawing area with OriginalRefFillColour */
+ /* delete the old drawing area and create a new one at the new size */
+ free_MHEGCanvas(t->inst.canvas);
+ t->inst.canvas = new_MHEGCanvas(t->inst.BoxSize.x_length, t->inst.BoxSize.y_length);
+
+ /* default value for BorderedBoundingBox is true */
+ if(!t->have_bordered_bounding_box || t->bordered_bounding_box)
+ MHEGCanvas_setBorder(t->inst.canvas, t->original_line_width, t->original_line_style, &t->inst.OriginalRefLineColour);
+
+ /* now we have set the border, clear the drawing area */
+ MHEGCanvas_clear(t->inst.canvas, &t->inst.OriginalRefFillColour);
+
/* if it is active, redraw it */
if(t->rootClass.inst.RunningStatus)
{
@@ -345,8 +353,8 @@
{
verbose("DynamicLineArtClass: %s; SetLineWidth", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_SetLineWidth not yet implemented\n");
+ t->inst.LineWidth = GenericInteger_getInteger(¶ms->new_line_width, caller_gid);
+
return;
}
@@ -355,8 +363,8 @@
{
verbose("DynamicLineArtClass: %s; SetLineStyle", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_SetLineStyle not yet implemented\n");
+ t->inst.LineStyle = GenericInteger_getInteger(¶ms->new_line_style, caller_gid);
+
return;
}
@@ -365,8 +373,8 @@
{
verbose("DynamicLineArtClass: %s; SetLineColour", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_SetLineColour not yet implemented\n");
+ MHEGColour_fromNewColour(&t->inst.RefLineColour, ¶ms->new_line_colour, caller_gid);
+
return;
}
@@ -375,28 +383,56 @@
{
verbose("DynamicLineArtClass: %s; SetFillColour", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_SetFillColour not yet implemented\n");
+ /* if no colour is given, use transparent */
+ if(params->have_new_fill_colour)
+ MHEGColour_fromNewColour(&t->inst.RefFillColour, ¶ms->new_fill_colour, caller_gid);
+ else
+ MHEGColour_transparent(&t->inst.RefFillColour);
+
return;
}
void
DynamicLineArtClass_GetLineWidth(DynamicLineArtClass *t, GetLineWidth *params, OctetString *caller_gid)
{
+ VariableClass *var;
+
verbose("DynamicLineArtClass: %s; GetLineWidth", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_GetLineWidth not yet implemented\n");
+ if((var = (VariableClass *) MHEGEngine_findObjectReference(¶ms->line_width_var, caller_gid)) == NULL)
+ return;
+
+ if(var->rootClass.inst.rtti != RTTI_VariableClass
+ || VariableClass_type(var) != OriginalValue_integer)
+ {
+ error("DynamicLineArtClass: GetLineWidth: type mismatch");
+ return;
+ }
+
+ IntegerVariableClass_setInteger(var, t->inst.LineWidth);
+
return;
}
void
DynamicLineArtClass_GetLineStyle(DynamicLineArtClass *t, GetLineStyle *params, OctetString *caller_gid)
{
+ VariableClass *var;
+
verbose("DynamicLineArtClass: %s; GetLineStyle", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_GetLineStyle not yet implemented\n");
+ if((var = (VariableClass *) MHEGEngine_findObjectReference(¶ms->line_style_var, caller_gid)) == NULL)
+ return;
+
+ if(var->rootClass.inst.rtti != RTTI_VariableClass
+ || VariableClass_type(var) != OriginalValue_integer)
+ {
+ error("DynamicLineArtClass: GetLineStyle: type mismatch");
+ return;
+ }
+
+ IntegerVariableClass_setInteger(var, t->inst.LineStyle);
+
return;
}
@@ -495,8 +531,13 @@
{
verbose("DynamicLineArtClass: %s; Clear", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_Clear not yet implemented\n");
+ /* fill with OriginalRefFillColour */
+ MHEGCanvas_clear(t->inst.canvas, &t->inst.OriginalRefFillColour);
+
+ /* if it is active, redraw it */
+ if(t->rootClass.inst.RunningStatus)
+ MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
+
return;
}
Modified: redbutton-browser/trunk/MHEGCanvas.c
===================================================================
--- redbutton-browser/trunk/MHEGCanvas.c 2007-03-12 12:21:15 UTC (rev 242)
+++ redbutton-browser/trunk/MHEGCanvas.c 2007-03-12 17:08:27 UTC (rev 243)
@@ -21,15 +21,18 @@
free_MHEGCanvas(MHEGCanvas *c)
{
safe_free(c);
+
+ return;
}
/*
* set a border, no drawing will be done in the border (apart from the border itself)
* width is in pixels
* style should be one of:
- * original_line_style_solid
- * original_line_style_dashed
- * original_line_style_dotted
+ * LineStyle_solid
+ * LineStyle_dashed
+ * LineStyle_dotted
+ * (note: UK MHEG Profile says we can treat ALL line styles as solid)
*/
void
@@ -38,6 +41,9 @@
if(width <= 0)
return;
+ if(style != LineStyle_solid)
+ error("MHEGCanvas_setBorder: LineStyle %d not supported (using a solid line)", style);
+
/* TODO */
printf("TODO: MHEGCanvas_setBorder: width=%d style=%d RGBT=%02x%02x%02x%02x\n", width, style, colour->r, colour->g, colour->b, colour->t);
@@ -45,6 +51,14 @@
}
/*
+ * drawing routine notes:
+ * if border width is W, then coord {W,W} is the first pixel that will not be hidden by the border
+ * UK MHEG Profile says we can treat ALL line styles as solid
+ * UK MHEG Profile says no alpha blending is done within the DynamicLineArt canvas
+ * ie all pixel values are put directly onto the canvas, replacing what was there before
+ */
+
+/*
* fill the image (excluding the border) with the given colour
*/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-13 12:22:43
|
Revision: 244
http://svn.sourceforge.net/redbutton/?rev=244&view=rev
Author: skilvington
Date: 2007-03-13 05:22:39 -0700 (Tue, 13 Mar 2007)
Log Message:
-----------
create, delete and define borders for MHEGCanvas
Modified Paths:
--------------
redbutton-browser/trunk/MHEGCanvas.c
redbutton-browser/trunk/MHEGCanvas.h
Modified: redbutton-browser/trunk/MHEGCanvas.c
===================================================================
--- redbutton-browser/trunk/MHEGCanvas.c 2007-03-12 17:08:27 UTC (rev 243)
+++ redbutton-browser/trunk/MHEGCanvas.c 2007-03-13 12:22:39 UTC (rev 244)
@@ -2,24 +2,57 @@
* MHEGCanvas.c
*/
+#include <X11/Xlib.h>
+#include <X11/extensions/Xrender.h>
+
#include "ISO13522-MHEG-5.h"
#include "MHEGCanvas.h"
+#include "MHEGEngine.h"
#include "utils.h"
+/* internal functions */
+static unsigned long pixel_value(XRenderPictFormat *, MHEGColour *);
+
MHEGCanvas *
new_MHEGCanvas(unsigned int width, unsigned int height)
{
MHEGCanvas *c = safe_mallocz(sizeof(MHEGCanvas));
+ MHEGDisplay *d = MHEGEngine_getDisplay();
-/* TODO */
-printf("TODO: new_MHEGCanvas(%u, %u)\n", width, height);
+ /* scale width/height if fullscreen */
+ c->width = (width * d->xres) / MHEG_XRES;
+ c->height = (height * d->yres) / MHEG_YRES;
+ /* no border set yet */
+ c->border = 0;
+
+ /* we want a 32-bit RGBA pixel format */
+ c->pic_format = XRenderFindStandardFormat(d->dpy, PictStandardARGB32);
+
+ /* create a Pixmap to draw on */
+ c->contents = XCreatePixmap(d->dpy, d->win, c->width, c->height, 32);
+ /* associate a Picture with it */
+ c->contents_pic = XRenderCreatePicture(d->dpy, c->contents, c->pic_format, 0, NULL);
+
+ /* and a Graphics Context */
+ c->gc = XCreateGC(d->dpy, c->contents, 0, NULL);
+
return c;
}
void
free_MHEGCanvas(MHEGCanvas *c)
{
+ MHEGDisplay *d = MHEGEngine_getDisplay();
+
+ /* assert */
+ if(c == NULL)
+ fatal("free_MHEGCanvas: passed a NULL canvas");
+
+ XRenderFreePicture(d->dpy, c->contents_pic);
+ XFreePixmap(d->dpy, c->contents);
+ XFreeGC(d->dpy, c->gc);
+
safe_free(c);
return;
@@ -27,7 +60,7 @@
/*
* set a border, no drawing will be done in the border (apart from the border itself)
- * width is in pixels
+ * width is in pixels (and will be scaled up by this routine in full screen mode)
* style should be one of:
* LineStyle_solid
* LineStyle_dashed
@@ -38,23 +71,47 @@
void
MHEGCanvas_setBorder(MHEGCanvas *c, int width, int style, MHEGColour *colour)
{
+ MHEGDisplay *d = MHEGEngine_getDisplay();
+ XGCValues gcvals;
+ XRectangle clip_rect;
+
if(width <= 0)
return;
if(style != LineStyle_solid)
error("MHEGCanvas_setBorder: LineStyle %d not supported (using a solid line)", style);
-/* TODO */
-printf("TODO: MHEGCanvas_setBorder: width=%d style=%d RGBT=%02x%02x%02x%02x\n", width, style, colour->r, colour->g, colour->b, colour->t);
+ /* scale width if fullscreen */
+ c->border = (width * d->xres) / MHEG_XRES;
+ /* draw the border */
+ gcvals.foreground = pixel_value(c->pic_format, colour);
+ XChangeGC(d->dpy, c->gc, GCForeground, &gcvals);
+ /* top */
+ XFillRectangle(d->dpy, c->contents, c->gc, 0, 0, c->width, c->border - 1);
+ /* bottom */
+ XFillRectangle(d->dpy, c->contents, c->gc, 0, (c->height - c->border) - 1, c->width, c->border - 1);
+ /* left */
+ XFillRectangle(d->dpy, c->contents, c->gc, 0, 0, c->border - 1, c->height);
+ /* right */
+ XFillRectangle(d->dpy, c->contents, c->gc, (c->width - c->border) - 1, 0, c->border - 1, c->height);
+
+ /* set a clip mask, so no futher drawing will change the border */
+ clip_rect.x = c->border;
+ clip_rect.y = c->border;
+ clip_rect.width = c->width - (2 * c->border);
+ clip_rect.height = c->height - (2 * c->border);
+ XSetClipRectangles(d->dpy, c->gc, 0, 0, &clip_rect, 1, Unsorted);
+
return;
}
/*
* drawing routine notes:
* if border width is W, then coord {W,W} is the first pixel that will not be hidden by the border
+ * all coords will be scaled up by these drawing routines if we are using full screen mode
* UK MHEG Profile says we can treat ALL line styles as solid
- * UK MHEG Profile says no alpha blending is done within the DynamicLineArt canvas
+ * UK MHEG Profile says no alpha blending is done within the DynamicLineArtClass canvas
* ie all pixel values are put directly onto the canvas, replacing what was there before
*/
@@ -71,3 +128,22 @@
return;
}
+/*
+ * convert the MHEGColour to a pixel value
+ */
+
+static unsigned long
+pixel_value(XRenderPictFormat *format, MHEGColour *colour)
+{
+ unsigned long pixel;
+
+ /* MHEGColour and PictStandardARGB32 both have 8-bits per RGBA component */
+ pixel = colour->r << format->direct.red;
+ pixel |= colour->g << format->direct.green;
+ pixel |= colour->b << format->direct.blue;
+ /* MHEGColour uses transparency, XRender uses opacity */
+ pixel |= (255 - colour->t) << format->direct.alpha;
+
+ return pixel;
+}
+
Modified: redbutton-browser/trunk/MHEGCanvas.h
===================================================================
--- redbutton-browser/trunk/MHEGCanvas.h 2007-03-12 17:08:27 UTC (rev 243)
+++ redbutton-browser/trunk/MHEGCanvas.h 2007-03-13 12:22:39 UTC (rev 244)
@@ -10,9 +10,13 @@
typedef struct
{
- Pixmap contents; /* current image */
- Picture contents_pic; /* XRender wrapper */
- GC gc; /* contains the clip mask for the border */
+ unsigned int width; /* in pixels, will be the scaled up value in fullscreen mode */
+ unsigned int height; /* in pixels, will be the scaled up value in fullscreen mode */
+ unsigned int border; /* border width in pixels (the scaled value in fullscreen mode) */
+ Pixmap contents; /* current image */
+ Picture contents_pic; /* XRender wrapper */
+ XRenderPictFormat *pic_format; /* pixel format */
+ GC gc; /* contains the clip mask for the border */
} MHEGCanvas;
MHEGCanvas *new_MHEGCanvas(unsigned int, unsigned int);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-13 14:06:29
|
Revision: 245
http://svn.sourceforge.net/redbutton/?rev=245&view=rev
Author: skilvington
Date: 2007-03-13 07:06:18 -0700 (Tue, 13 Mar 2007)
Log Message:
-----------
draw MHEGCanvas objects
Modified Paths:
--------------
redbutton-browser/trunk/DynamicLineArtClass.c
redbutton-browser/trunk/MHEGDisplay.c
redbutton-browser/trunk/MHEGDisplay.h
Modified: redbutton-browser/trunk/DynamicLineArtClass.c
===================================================================
--- redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-13 12:22:39 UTC (rev 244)
+++ redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-13 14:06:18 UTC (rev 245)
@@ -546,6 +546,7 @@
{
XYPosition ins_pos;
OriginalBoxSize ins_box;
+ XYPosition src;
verbose("DynamicLineArtClass: %s; render", ExternalReference_name(&t->rootClass.inst.ref));
@@ -554,9 +555,12 @@
MHEGDisplay_setClipRectangle(d, &ins_pos, &ins_box);
-/* TODO */
-printf("TODO: DynamicLineArtClass_render\n");
+ /* work out where the intersection starts on the canvas */
+ src.x_position = ins_pos.x_position - t->inst.Position.x_position;
+ src.y_position = ins_pos.y_position - t->inst.Position.y_position;
+ MHEGDisplay_drawCanvas(d, &src, &ins_box, t->inst.canvas, &ins_pos);
+
MHEGDisplay_unsetClipRectangle(d);
return;
Modified: redbutton-browser/trunk/MHEGDisplay.c
===================================================================
--- redbutton-browser/trunk/MHEGDisplay.c 2007-03-13 12:22:39 UTC (rev 244)
+++ redbutton-browser/trunk/MHEGDisplay.c 2007-03-13 14:06:18 UTC (rev 245)
@@ -591,7 +591,34 @@
XRenderComposite(d->dpy, PictOpOver, bitmap->image_pic, None, d->next_overlay_pic,
src_x, src_y, src_x, src_y, dst_x, dst_y, w, h);
+ return;
+}
+/*
+ * coords should be in the range 0-MHEG_XRES, 0-MHEG_YRES
+ */
+
+void
+MHEGDisplay_drawCanvas(MHEGDisplay *d, XYPosition *src, OriginalBoxSize *box, MHEGCanvas *canvas, XYPosition *dst)
+{
+ int src_x, src_y;
+ int dst_x, dst_y;
+ unsigned int w, h;
+
+ /*
+ * scale up if fullscreen
+ * the canvas image itself is scaled when it is created
+ */
+ src_x = (src->x_position * d->xres) / MHEG_XRES;
+ src_y = (src->y_position * d->yres) / MHEG_YRES;
+ w = (box->x_length * d->xres) / MHEG_XRES;
+ h = (box->y_length * d->yres) / MHEG_YRES;
+ dst_x = (dst->x_position * d->xres) / MHEG_XRES;
+ dst_y = (dst->y_position * d->yres) / MHEG_YRES;
+
+ XRenderComposite(d->dpy, PictOpOver, canvas->contents_pic, None, d->next_overlay_pic,
+ src_x, src_y, src_x, src_y, dst_x, dst_y, w, h);
+
return;
}
Modified: redbutton-browser/trunk/MHEGDisplay.h
===================================================================
--- redbutton-browser/trunk/MHEGDisplay.h 2007-03-13 12:22:39 UTC (rev 244)
+++ redbutton-browser/trunk/MHEGDisplay.h 2007-03-13 14:06:18 UTC (rev 245)
@@ -72,6 +72,7 @@
void MHEGDisplay_fillTransparentRectangle(MHEGDisplay *, XYPosition *, OriginalBoxSize *);
void MHEGDisplay_fillRectangle(MHEGDisplay *, XYPosition *, OriginalBoxSize *, MHEGColour *);
void MHEGDisplay_drawBitmap(MHEGDisplay *, XYPosition *, OriginalBoxSize *, MHEGBitmap *, XYPosition *);
+void MHEGDisplay_drawCanvas(MHEGDisplay *, XYPosition *, OriginalBoxSize *, MHEGCanvas *, XYPosition *);
void MHEGDisplay_drawTextElement(MHEGDisplay *, XYPosition *, MHEGFont *, MHEGTextElement *, bool);
void MHEGDisplay_useOverlay(MHEGDisplay *);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-13 17:10:39
|
Revision: 248
http://svn.sourceforge.net/redbutton/?rev=248&view=rev
Author: skilvington
Date: 2007-03-13 10:10:33 -0700 (Tue, 13 Mar 2007)
Log Message:
-----------
DrawLine/Oval/Rectangle DynamicLineArtClass methods
Modified Paths:
--------------
redbutton-browser/trunk/DynamicLineArtClass.c
redbutton-browser/trunk/MHEGCanvas.c
redbutton-browser/trunk/MHEGCanvas.h
Modified: redbutton-browser/trunk/DynamicLineArtClass.c
===================================================================
--- redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-13 14:27:19 UTC (rev 247)
+++ redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-13 17:10:33 UTC (rev 248)
@@ -479,20 +479,46 @@
void
DynamicLineArtClass_DrawLine(DynamicLineArtClass *t, DrawLine *params, OctetString *caller_gid)
{
+ XYPosition p1;
+ XYPosition p2;
+
verbose("DynamicLineArtClass: %s; DrawLine", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_DrawLine not yet implemented\n");
+ p1.x_position = GenericInteger_getInteger(¶ms->x1, caller_gid);
+ p1.y_position = GenericInteger_getInteger(¶ms->y1, caller_gid);
+ p2.x_position = GenericInteger_getInteger(¶ms->x2, caller_gid);
+ p2.y_position = GenericInteger_getInteger(¶ms->y2, caller_gid);
+
+ MHEGCanvas_drawLine(t->inst.canvas, &p1, &p2, t->inst.LineWidth, t->inst.LineStyle, &t->inst.RefLineColour);
+
+ /* if it is active, redraw it */
+ if(t->rootClass.inst.RunningStatus)
+ MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
+
return;
}
void
DynamicLineArtClass_DrawOval(DynamicLineArtClass *t, DrawOval *params, OctetString *caller_gid)
{
+ XYPosition pos;
+ OriginalBoxSize box;
+
verbose("DynamicLineArtClass: %s; DrawOval", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_DrawOval not yet implemented\n");
+ pos.x_position = GenericInteger_getInteger(¶ms->x, caller_gid);
+ pos.y_position = GenericInteger_getInteger(¶ms->y, caller_gid);
+ box.x_length = GenericInteger_getInteger(¶ms->ellipse_width, caller_gid);
+ box.y_length = GenericInteger_getInteger(¶ms->ellipse_height, caller_gid);
+
+ MHEGCanvas_drawOval(t->inst.canvas, &pos, &box,
+ t->inst.LineWidth, t->inst.LineStyle,
+ &t->inst.RefLineColour, &t->inst.RefFillColour);
+
+ /* if it is active, redraw it */
+ if(t->rootClass.inst.RunningStatus)
+ MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
+
return;
}
@@ -519,10 +545,24 @@
void
DynamicLineArtClass_DrawRectangle(DynamicLineArtClass *t, DrawRectangle *params, OctetString *caller_gid)
{
+ XYPosition pos;
+ OriginalBoxSize box;
+
verbose("DynamicLineArtClass: %s; DrawRectangle", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_DrawRectangle not yet implemented\n");
+ pos.x_position = GenericInteger_getInteger(¶ms->x1, caller_gid);
+ pos.y_position = GenericInteger_getInteger(¶ms->y1, caller_gid);
+ box.x_length = GenericInteger_getInteger(¶ms->x2, caller_gid) - pos.x_position;
+ box.y_length = GenericInteger_getInteger(¶ms->y2, caller_gid) - pos.y_position;
+
+ MHEGCanvas_drawRectangle(t->inst.canvas, &pos, &box,
+ t->inst.LineWidth, t->inst.LineStyle,
+ &t->inst.RefLineColour, &t->inst.RefFillColour);
+
+ /* if it is active, redraw it */
+ if(t->rootClass.inst.RunningStatus)
+ MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
+
return;
}
Modified: redbutton-browser/trunk/MHEGCanvas.c
===================================================================
--- redbutton-browser/trunk/MHEGCanvas.c 2007-03-13 14:27:19 UTC (rev 247)
+++ redbutton-browser/trunk/MHEGCanvas.c 2007-03-13 17:10:33 UTC (rev 248)
@@ -110,7 +110,12 @@
* drawing routine notes:
* if border width is W, then coord {W,W} is the first pixel that will not be hidden by the border
* all coords will be scaled up by these drawing routines if we are using full screen mode
- * UK MHEG Profile says we can treat ALL line styles as solid
+ * the line width will also be scaled up in full screen mode (based on the resolution in the X direction)
+ * line style should be one of:
+ * LineStyle_solid
+ * LineStyle_dashed
+ * LineStyle_dotted
+ * but, the UK MHEG Profile says we can treat ALL line styles as solid
* UK MHEG Profile says no alpha blending is done within the DynamicLineArtClass canvas
* ie all pixel values are put directly onto the canvas, replacing what was there before
*/
@@ -135,6 +140,125 @@
}
/*
+ * draw a line between p1 and p2
+ */
+
+void
+MHEGCanvas_drawLine(MHEGCanvas *c, XYPosition *p1, XYPosition *p2, int width, int style, MHEGColour *colour)
+{
+ MHEGDisplay *d = MHEGEngine_getDisplay();
+ XGCValues gcvals;
+ int x1, y1, x2, y2;
+
+ if(width <= 0)
+ return;
+
+ if(style != LineStyle_solid)
+ error("MHEGCanvas_drawLine: LineStyle %d not supported (using a solid line)", style);
+
+ /* scale up if fullscreen */
+ x1 = (p1->x_position * d->xres) / MHEG_XRES;
+ y1 = (p1->y_position * d->yres) / MHEG_YRES;
+ x2 = (p2->x_position * d->xres) / MHEG_XRES;
+ y2 = (p2->y_position * d->yres) / MHEG_YRES;
+ width = (width * d->xres) / MHEG_XRES;
+
+ /* set up the GC values */
+ gcvals.foreground = pixel_value(c->pic_format, colour);
+ gcvals.line_width = width;
+ XChangeGC(d->dpy, c->gc, GCForeground | GCLineWidth, &gcvals);
+
+ XDrawLine(d->dpy, c->contents, c->gc, x1, y1, x2, y2);
+
+ return;
+}
+
+/*
+ * draw an oval enclosed by the given box
+ * the outline is drawn width pixels wide (ie it may stick out of the box) in line_col
+ * the oval is filled with fill_col
+ */
+
+void
+MHEGCanvas_drawOval(MHEGCanvas *c, XYPosition *pos, OriginalBoxSize *box, int width, int style, MHEGColour *line_col, MHEGColour *fill_col)
+{
+ MHEGDisplay *d = MHEGEngine_getDisplay();
+ XGCValues gcvals;
+ int x, y, w, h;
+
+ /* corrigendum puts these limits on the ellipse size */
+ if(box->x_length < 0 || box->y_length < 0)
+ {
+ error("MHEGCanvas_drawOval: invalid box size (%d,%d)", box->x_length, box->y_length);
+ return;
+ }
+
+ if(style != LineStyle_solid)
+ error("MHEGCanvas_drawOval: LineStyle %d not supported (using a solid line)", style);
+
+ /* scale up if fullscreen */
+ x = (pos->x_position * d->xres) / MHEG_XRES;
+ y = (pos->y_position * d->yres) / MHEG_YRES;
+ w = (box->x_length * d->xres) / MHEG_XRES;
+ h = (box->y_length * d->yres) / MHEG_YRES;
+ width = (width * d->xres) / MHEG_XRES;
+
+ /* fill it */
+ gcvals.foreground = pixel_value(c->pic_format, fill_col);
+ XChangeGC(d->dpy, c->gc, GCForeground, &gcvals);
+
+ XFillArc(d->dpy, c->contents, c->gc, x, y, w, h, 0, 360 * 64);
+
+ /* draw the outline */
+ gcvals.foreground = pixel_value(c->pic_format, line_col);
+ gcvals.line_width = width;
+ XChangeGC(d->dpy, c->gc, GCForeground | GCLineWidth, &gcvals);
+
+ XDrawArc(d->dpy, c->contents, c->gc, x, y, w, h, 0, 360 * 64);
+
+ return;
+}
+
+/*
+ * draw a rectangle
+ * the outline is drawn width pixels wide (ie it may stick out of the box) in line_col
+ * it is filled with fill_col
+ */
+
+void
+MHEGCanvas_drawRectangle(MHEGCanvas *c, XYPosition *pos, OriginalBoxSize *box, int width, int style, MHEGColour *line_col, MHEGColour *fill_col)
+{
+ MHEGDisplay *d = MHEGEngine_getDisplay();
+ XGCValues gcvals;
+ int x, y, w, h;
+
+ if(style != LineStyle_solid)
+ error("MHEGCanvas_drawRectangle: LineStyle %d not supported (using a solid line)", style);
+
+ /* scale up if fullscreen */
+ x = (pos->x_position * d->xres) / MHEG_XRES;
+ y = (pos->y_position * d->yres) / MHEG_YRES;
+ w = (box->x_length * d->xres) / MHEG_XRES;
+ h = (box->y_length * d->yres) / MHEG_YRES;
+ width = (width * d->xres) / MHEG_XRES;
+
+ /* fill it */
+ gcvals.foreground = pixel_value(c->pic_format, fill_col);
+ XChangeGC(d->dpy, c->gc, GCForeground, &gcvals);
+
+ XFillRectangle(d->dpy, c->contents, c->gc, x, y, w, h);
+
+ /* draw the outline */
+ gcvals.foreground = pixel_value(c->pic_format, line_col);
+ gcvals.line_width = width;
+ XChangeGC(d->dpy, c->gc, GCForeground | GCLineWidth, &gcvals);
+
+ XDrawRectangle(d->dpy, c->contents, c->gc, x, y, w, h);
+
+ return;
+}
+
+/*
* convert the MHEGColour to a pixel value
*/
Modified: redbutton-browser/trunk/MHEGCanvas.h
===================================================================
--- redbutton-browser/trunk/MHEGCanvas.h 2007-03-13 14:27:19 UTC (rev 247)
+++ redbutton-browser/trunk/MHEGCanvas.h 2007-03-13 17:10:33 UTC (rev 248)
@@ -25,6 +25,9 @@
void MHEGCanvas_setBorder(MHEGCanvas *, int, int, MHEGColour *);
void MHEGCanvas_clear(MHEGCanvas *, MHEGColour *);
+void MHEGCanvas_drawLine(MHEGCanvas *, XYPosition *, XYPosition *, int, int, MHEGColour *);
+void MHEGCanvas_drawOval(MHEGCanvas *, XYPosition *, OriginalBoxSize *, int, int, MHEGColour *, MHEGColour *);
+void MHEGCanvas_drawRectangle(MHEGCanvas *, XYPosition *, OriginalBoxSize *, int, int, MHEGColour *, MHEGColour *);
#endif /* __MHEGCANVAS_H__ */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-16 16:57:13
|
Revision: 249
http://svn.sourceforge.net/redbutton/?rev=249&view=rev
Author: skilvington
Date: 2007-03-16 09:57:08 -0700 (Fri, 16 Mar 2007)
Log Message:
-----------
DrawArc/Sector DynamicLineArtClass methods
Modified Paths:
--------------
redbutton-browser/trunk/DynamicLineArtClass.c
redbutton-browser/trunk/MHEGCanvas.c
redbutton-browser/trunk/MHEGCanvas.h
Modified: redbutton-browser/trunk/DynamicLineArtClass.c
===================================================================
--- redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-13 17:10:33 UTC (rev 248)
+++ redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-16 16:57:08 UTC (rev 249)
@@ -459,20 +459,67 @@
void
DynamicLineArtClass_DrawArc(DynamicLineArtClass *t, DrawArc *params, OctetString *caller_gid)
{
+ XYPosition pos;
+ OriginalBoxSize box;
+ int start;
+ int arc;
+
verbose("DynamicLineArtClass: %s; DrawArc", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_DrawArc not yet implemented\n");
+ pos.x_position = GenericInteger_getInteger(¶ms->x, caller_gid);
+ pos.y_position = GenericInteger_getInteger(¶ms->y, caller_gid);
+ box.x_length = GenericInteger_getInteger(¶ms->ellipse_width, caller_gid);
+ box.y_length = GenericInteger_getInteger(¶ms->ellipse_height, caller_gid);
+ start = GenericInteger_getInteger(¶ms->start_angle, caller_gid);
+ arc = GenericInteger_getInteger(¶ms->arc_angle, caller_gid);
+
+ /* ISO spec says ArcAngle should not be 0 */
+ if(arc == 0)
+ {
+ error("DynamicLineArtClass_DrawArc: invalid ArcAngle (%d)", arc);
+ return;
+ }
+
+ MHEGCanvas_drawArc(t->inst.canvas, &pos, &box, start, arc, t->inst.LineWidth, t->inst.LineStyle, &t->inst.RefLineColour);
+
+ /* if it is active, redraw it */
+ if(t->rootClass.inst.RunningStatus)
+ MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
+
return;
}
void
DynamicLineArtClass_DrawSector(DynamicLineArtClass *t, DrawSector *params, OctetString *caller_gid)
{
+ XYPosition pos;
+ OriginalBoxSize box;
+ int start;
+ int arc;
+
verbose("DynamicLineArtClass: %s; DrawSector", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_DrawSector not yet implemented\n");
+ pos.x_position = GenericInteger_getInteger(¶ms->x, caller_gid);
+ pos.y_position = GenericInteger_getInteger(¶ms->y, caller_gid);
+ box.x_length = GenericInteger_getInteger(¶ms->ellipse_width, caller_gid);
+ box.y_length = GenericInteger_getInteger(¶ms->ellipse_height, caller_gid);
+ start = GenericInteger_getInteger(¶ms->start_angle, caller_gid);
+ arc = GenericInteger_getInteger(¶ms->arc_angle, caller_gid);
+
+ /* ISO spec says ArcAngle should not be 0 */
+ if(arc == 0)
+ {
+ error("DynamicLineArtClass_DrawSector: invalid ArcAngle (%d)", arc);
+ return;
+ }
+
+ MHEGCanvas_drawSector(t->inst.canvas, &pos, &box, start, arc,
+ t->inst.LineWidth, t->inst.LineStyle, &t->inst.RefLineColour, &t->inst.RefFillColour);
+
+ /* if it is active, redraw it */
+ if(t->rootClass.inst.RunningStatus)
+ MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
+
return;
}
Modified: redbutton-browser/trunk/MHEGCanvas.c
===================================================================
--- redbutton-browser/trunk/MHEGCanvas.c 2007-03-13 17:10:33 UTC (rev 248)
+++ redbutton-browser/trunk/MHEGCanvas.c 2007-03-16 16:57:08 UTC (rev 249)
@@ -2,6 +2,7 @@
* MHEGCanvas.c
*/
+#include <math.h>
#include <X11/Xlib.h>
#include <X11/extensions/Xrender.h>
@@ -140,6 +141,113 @@
}
/*
+ * draw an arc enclosed by the given box, starting at start (0 = 3 o' clock) for arc degrees anticlockwise
+ * start and arc should be in degrees * 64
+ * the arc is drawn width pixels wide (ie it may stick out of the box) in the given colour
+ */
+
+void
+MHEGCanvas_drawArc(MHEGCanvas *c, XYPosition *pos, OriginalBoxSize *box, int start, int arc, int width, int style, MHEGColour *colour)
+{
+ MHEGDisplay *d = MHEGEngine_getDisplay();
+ XGCValues gcvals;
+ int x, y, w, h;
+
+ if(width <= 0)
+ return;
+
+ if(style != LineStyle_solid)
+ error("MHEGCanvas_drawArc: LineStyle %d not supported (using a solid line)", style);
+
+ /* scale up if fullscreen */
+ x = (pos->x_position * d->xres) / MHEG_XRES;
+ y = (pos->y_position * d->yres) / MHEG_YRES;
+ w = (box->x_length * d->xres) / MHEG_XRES;
+ h = (box->y_length * d->yres) / MHEG_YRES;
+ width = (width * d->xres) / MHEG_XRES;
+
+ /* set up the GC values */
+ gcvals.foreground = pixel_value(c->pic_format, colour);
+ gcvals.line_width = width;
+ XChangeGC(d->dpy, c->gc, GCForeground | GCLineWidth, &gcvals);
+
+ /* luckily X uses the same params as MHEG */
+ XDrawArc(d->dpy, c->contents, c->gc, x, y, w, h, start, arc);
+
+ return;
+}
+
+/*
+ * draw a pie chart sector enclosed by the given box, starting at start (0 = 3 o' clock) for arc degrees anticlockwise
+ * start and arc should be in degrees * 64
+ * the sector is drawn in fill_col
+ * the sector is outlined with a line width pixels wide (ie it may stick out of the box) in line_col
+ */
+
+void
+MHEGCanvas_drawSector(MHEGCanvas *c,
+ XYPosition *pos, OriginalBoxSize *box, int start, int arc,
+ int width, int style, MHEGColour *line_col, MHEGColour *fill_col)
+{
+ MHEGDisplay *d = MHEGEngine_getDisplay();
+ XGCValues gcvals;
+ int x, y, w, h;
+ int cx, cy;
+ double start_rads, end_rads;
+ int edgex, edgey;
+
+ if(style != LineStyle_solid)
+ error("MHEGCanvas_drawSector: LineStyle %d not supported (using a solid line)", style);
+
+ /* scale up if fullscreen */
+ x = (pos->x_position * d->xres) / MHEG_XRES;
+ y = (pos->y_position * d->yres) / MHEG_YRES;
+ w = (box->x_length * d->xres) / MHEG_XRES;
+ h = (box->y_length * d->yres) / MHEG_YRES;
+ width = (width * d->xres) / MHEG_XRES;
+
+ /* fill it */
+ gcvals.foreground = pixel_value(c->pic_format, fill_col);
+ gcvals.arc_mode = ArcPieSlice;
+ XChangeGC(d->dpy, c->gc, GCForeground | GCArcMode, &gcvals);
+
+ /* luckily X uses the same params as MHEG */
+ XFillArc(d->dpy, c->contents, c->gc, x, y, w, h, start, arc);
+
+ /* draw the outline */
+ if(width <= 0)
+ return;
+
+ gcvals.foreground = pixel_value(c->pic_format, line_col);
+ gcvals.line_width = width;
+ XChangeGC(d->dpy, c->gc, GCForeground | GCLineWidth, &gcvals);
+
+ /* easy bit */
+ XDrawArc(d->dpy, c->contents, c->gc, x, y, w, h, start, arc);
+
+ /* lines from the centre to the start and end of the arc */
+ cx = x + (w / 2);
+ cy = y + (h / 2);
+ start_rads = ((double) start / 64.0) * M_PI / 180.0;
+ edgex = cos(start_rads) * (w / 2);
+ edgey = sin(start_rads) * (h / 2);
+ /* cy - edgey, because Y increases as we go down the screen */
+ XDrawLine(d->dpy, c->contents, c->gc, cx, cy, cx + edgex, cy - edgey);
+
+ end_rads = ((double) (start + arc) / 64.0) * M_PI / 180.0;
+ edgex = cos(end_rads) * (w / 2);
+ edgey = sin(end_rads) * (h / 2);
+ XDrawLine(d->dpy, c->contents, c->gc, cx, cy, cx + edgex, cy - edgey);
+
+/* TODO */
+/* make proper joins between the arc and the 2 lines */
+/* ends of the arc are on a tangent to the ellipse */
+/* can't join to a length 0 line because it has no direction, but a 1 pixel long line may be too long */
+
+ return;
+}
+
+/*
* draw a line between p1 and p2
*/
@@ -210,6 +318,9 @@
XFillArc(d->dpy, c->contents, c->gc, x, y, w, h, 0, 360 * 64);
/* draw the outline */
+ if(width <= 0)
+ return;
+
gcvals.foreground = pixel_value(c->pic_format, line_col);
gcvals.line_width = width;
XChangeGC(d->dpy, c->gc, GCForeground | GCLineWidth, &gcvals);
@@ -249,6 +360,9 @@
XFillRectangle(d->dpy, c->contents, c->gc, x, y, w, h);
/* draw the outline */
+ if(width <= 0)
+ return;
+
gcvals.foreground = pixel_value(c->pic_format, line_col);
gcvals.line_width = width;
XChangeGC(d->dpy, c->gc, GCForeground | GCLineWidth, &gcvals);
Modified: redbutton-browser/trunk/MHEGCanvas.h
===================================================================
--- redbutton-browser/trunk/MHEGCanvas.h 2007-03-13 17:10:33 UTC (rev 248)
+++ redbutton-browser/trunk/MHEGCanvas.h 2007-03-16 16:57:08 UTC (rev 249)
@@ -25,6 +25,8 @@
void MHEGCanvas_setBorder(MHEGCanvas *, int, int, MHEGColour *);
void MHEGCanvas_clear(MHEGCanvas *, MHEGColour *);
+void MHEGCanvas_drawArc(MHEGCanvas *, XYPosition *, OriginalBoxSize *, int, int, int, int, MHEGColour *);
+void MHEGCanvas_drawSector(MHEGCanvas *, XYPosition *, OriginalBoxSize *, int, int, int, int, MHEGColour *, MHEGColour *);
void MHEGCanvas_drawLine(MHEGCanvas *, XYPosition *, XYPosition *, int, int, MHEGColour *);
void MHEGCanvas_drawOval(MHEGCanvas *, XYPosition *, OriginalBoxSize *, int, int, MHEGColour *, MHEGColour *);
void MHEGCanvas_drawRectangle(MHEGCanvas *, XYPosition *, OriginalBoxSize *, int, int, MHEGColour *, MHEGColour *);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-19 12:08:09
|
Revision: 250
http://svn.sourceforge.net/redbutton/?rev=250&view=rev
Author: skilvington
Date: 2007-03-19 05:08:06 -0700 (Mon, 19 Mar 2007)
Log Message:
-----------
check ellipse size is >=0 in DynamicLineArtClass
Modified Paths:
--------------
redbutton-browser/trunk/DynamicLineArtClass.c
redbutton-browser/trunk/MHEGCanvas.c
Modified: redbutton-browser/trunk/DynamicLineArtClass.c
===================================================================
--- redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-16 16:57:08 UTC (rev 249)
+++ redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-19 12:08:06 UTC (rev 250)
@@ -479,6 +479,12 @@
error("DynamicLineArtClass_DrawArc: invalid ArcAngle (%d)", arc);
return;
}
+ /* corrigendum puts these limits on the ellipse size */
+ if(box.x_length < 0 || box.y_length < 0)
+ {
+ error("DynamicLineArtClass_DrawArc: invalid ellipse size (%d,%d)", box.x_length, box.y_length);
+ return;
+ }
MHEGCanvas_drawArc(t->inst.canvas, &pos, &box, start, arc, t->inst.LineWidth, t->inst.LineStyle, &t->inst.RefLineColour);
@@ -512,6 +518,12 @@
error("DynamicLineArtClass_DrawSector: invalid ArcAngle (%d)", arc);
return;
}
+ /* corrigendum puts these limits on the ellipse size */
+ if(box.x_length < 0 || box.y_length < 0)
+ {
+ error("DynamicLineArtClass_DrawSector: invalid ellipse size (%d,%d)", box.x_length, box.y_length);
+ return;
+ }
MHEGCanvas_drawSector(t->inst.canvas, &pos, &box, start, arc,
t->inst.LineWidth, t->inst.LineStyle, &t->inst.RefLineColour, &t->inst.RefFillColour);
@@ -558,6 +570,13 @@
box.x_length = GenericInteger_getInteger(¶ms->ellipse_width, caller_gid);
box.y_length = GenericInteger_getInteger(¶ms->ellipse_height, caller_gid);
+ /* corrigendum puts these limits on the ellipse size */
+ if(box.x_length < 0 || box.y_length < 0)
+ {
+ error("DynamicLineArtClass_DrawOval: invalid ellipse size (%d,%d)", box.x_length, box.y_length);
+ return;
+ }
+
MHEGCanvas_drawOval(t->inst.canvas, &pos, &box,
t->inst.LineWidth, t->inst.LineStyle,
&t->inst.RefLineColour, &t->inst.RefFillColour);
Modified: redbutton-browser/trunk/MHEGCanvas.c
===================================================================
--- redbutton-browser/trunk/MHEGCanvas.c 2007-03-16 16:57:08 UTC (rev 249)
+++ redbutton-browser/trunk/MHEGCanvas.c 2007-03-19 12:08:06 UTC (rev 250)
@@ -294,13 +294,6 @@
XGCValues gcvals;
int x, y, w, h;
- /* corrigendum puts these limits on the ellipse size */
- if(box->x_length < 0 || box->y_length < 0)
- {
- error("MHEGCanvas_drawOval: invalid box size (%d,%d)", box->x_length, box->y_length);
- return;
- }
-
if(style != LineStyle_solid)
error("MHEGCanvas_drawOval: LineStyle %d not supported (using a solid line)", style);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-22 17:42:33
|
Revision: 253
http://svn.sourceforge.net/redbutton/?rev=253&view=rev
Author: skilvington
Date: 2007-03-22 10:42:27 -0700 (Thu, 22 Mar 2007)
Log Message:
-----------
DrawPolygon DynamicLineArtClass method
Modified Paths:
--------------
redbutton-browser/trunk/DynamicLineArtClass.c
redbutton-browser/trunk/MHEGCanvas.c
redbutton-browser/trunk/MHEGCanvas.h
Modified: redbutton-browser/trunk/DynamicLineArtClass.c
===================================================================
--- redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-22 09:35:08 UTC (rev 252)
+++ redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-22 17:42:27 UTC (rev 253)
@@ -486,7 +486,9 @@
return;
}
- MHEGCanvas_drawArc(t->inst.canvas, &pos, &box, start, arc, t->inst.LineWidth, t->inst.LineStyle, &t->inst.RefLineColour);
+ MHEGCanvas_drawArc(t->inst.canvas, &pos, &box, start, arc,
+ t->inst.LineWidth, t->inst.LineStyle,
+ &t->inst.RefLineColour);
/* if it is active, redraw it */
if(t->rootClass.inst.RunningStatus)
@@ -526,7 +528,8 @@
}
MHEGCanvas_drawSector(t->inst.canvas, &pos, &box, start, arc,
- t->inst.LineWidth, t->inst.LineStyle, &t->inst.RefLineColour, &t->inst.RefFillColour);
+ t->inst.LineWidth, t->inst.LineStyle,
+ &t->inst.RefLineColour, &t->inst.RefFillColour);
/* if it is active, redraw it */
if(t->rootClass.inst.RunningStatus)
@@ -548,7 +551,9 @@
p2.x_position = GenericInteger_getInteger(¶ms->x2, caller_gid);
p2.y_position = GenericInteger_getInteger(¶ms->y2, caller_gid);
- MHEGCanvas_drawLine(t->inst.canvas, &p1, &p2, t->inst.LineWidth, t->inst.LineStyle, &t->inst.RefLineColour);
+ MHEGCanvas_drawLine(t->inst.canvas, &p1, &p2,
+ t->inst.LineWidth, t->inst.LineStyle,
+ &t->inst.RefLineColour);
/* if it is active, redraw it */
if(t->rootClass.inst.RunningStatus)
@@ -591,10 +596,30 @@
void
DynamicLineArtClass_DrawPolygon(DynamicLineArtClass *t, DrawPolygon *params, OctetString *caller_gid)
{
+ LIST_OF(XYPosition) *xy_list = NULL;
+ LIST_TYPE(XYPosition) *xy;
+ LIST_TYPE(Point) *pt;
+
verbose("DynamicLineArtClass: %s; DrawPolygon", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_DrawPolygon not yet implemented\n");
+ for(pt=params->pointlist; pt; pt=pt->next)
+ {
+ xy = safe_malloc(sizeof(LIST_TYPE(XYPosition)));
+ xy->item.x_position = GenericInteger_getInteger(&pt->item.x, caller_gid);
+ xy->item.y_position = GenericInteger_getInteger(&pt->item.y, caller_gid);
+ LIST_APPEND(&xy_list, xy);
+ }
+
+ MHEGCanvas_drawPolygon(t->inst.canvas, xy_list,
+ t->inst.LineWidth, t->inst.LineStyle,
+ &t->inst.RefLineColour, &t->inst.RefFillColour);
+
+ /* if it is active, redraw it */
+ if(t->rootClass.inst.RunningStatus)
+ MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
+
+ LIST_FREE(&xy_list, XYPosition, safe_free);
+
return;
}
Modified: redbutton-browser/trunk/MHEGCanvas.c
===================================================================
--- redbutton-browser/trunk/MHEGCanvas.c 2007-03-22 09:35:08 UTC (rev 252)
+++ redbutton-browser/trunk/MHEGCanvas.c 2007-03-22 17:42:27 UTC (rev 253)
@@ -324,6 +324,72 @@
}
/*
+ * draw a closed polygon
+ * the outline is drawn width pixels wide (ie it may stick out of the box) in line_col
+ * it is filled with fill_col
+ * UK MHEG Profile says polygons must be convex
+ */
+
+void
+MHEGCanvas_drawPolygon(MHEGCanvas *c, LIST_OF(XYPosition) *xy_list, int width, int style, MHEGColour *line_col, MHEGColour *fill_col)
+{
+ MHEGDisplay *d = MHEGEngine_getDisplay();
+ LIST_TYPE(XYPosition) *pos;
+ unsigned int nxpts;
+ XPoint *xpts;
+ unsigned int i;
+ XGCValues gcvals;
+
+ if(style != LineStyle_solid)
+ error("MHEGCanvas_drawPolygon: LineStyle %d not supported (using a solid line)", style);
+
+ /* scale up if fullscreen */
+ width = (width * d->xres) / MHEG_XRES;
+
+ /* convert the XYPosition list into an array of XPoint's */
+ nxpts = 0;
+ for(pos=xy_list; pos; pos=pos->next)
+ nxpts ++;
+
+ /* +1 so we can close it for XDrawLines */
+ xpts = safe_malloc((nxpts + 1) * sizeof(XPoint));
+
+ pos = xy_list;
+ for(i=0; i<nxpts; i++)
+ {
+ /* scale up if fullscreen */
+ xpts[i].x = (pos->item.x_position * d->xres) / MHEG_XRES;
+ xpts[i].y = (pos->item.y_position * d->yres) / MHEG_YRES;
+ pos = pos->next;
+ }
+
+ /* fill it */
+ gcvals.foreground = pixel_value(c->pic_format, fill_col);
+ XChangeGC(d->dpy, c->gc, GCForeground, &gcvals);
+
+ XFillPolygon(d->dpy, c->contents, c->gc, xpts, nxpts, Convex, CoordModeOrigin);
+
+ /* draw the outline */
+ if(width > 0)
+ {
+ /* close the polygon */
+ xpts[nxpts].x = (xy_list->item.x_position * d->xres) / MHEG_XRES;
+ xpts[nxpts].y = (xy_list->item.y_position * d->yres) / MHEG_YRES;
+ /* set the line width and colour */
+ gcvals.foreground = pixel_value(c->pic_format, line_col);
+ gcvals.line_width = width;
+ XChangeGC(d->dpy, c->gc, GCForeground | GCLineWidth, &gcvals);
+ /* draw it */
+ XDrawLines(d->dpy, c->contents, c->gc, xpts, nxpts + 1, CoordModeOrigin);
+ }
+
+ /* clean up */
+ safe_free(xpts);
+
+ return;
+}
+
+/*
* draw a rectangle
* the outline is drawn width pixels wide (ie it may stick out of the box) in line_col
* it is filled with fill_col
Modified: redbutton-browser/trunk/MHEGCanvas.h
===================================================================
--- redbutton-browser/trunk/MHEGCanvas.h 2007-03-22 09:35:08 UTC (rev 252)
+++ redbutton-browser/trunk/MHEGCanvas.h 2007-03-22 17:42:27 UTC (rev 253)
@@ -29,6 +29,7 @@
void MHEGCanvas_drawSector(MHEGCanvas *, XYPosition *, OriginalBoxSize *, int, int, int, int, MHEGColour *, MHEGColour *);
void MHEGCanvas_drawLine(MHEGCanvas *, XYPosition *, XYPosition *, int, int, MHEGColour *);
void MHEGCanvas_drawOval(MHEGCanvas *, XYPosition *, OriginalBoxSize *, int, int, MHEGColour *, MHEGColour *);
+void MHEGCanvas_drawPolygon(MHEGCanvas *, LIST_OF(XYPosition) *, int, int, MHEGColour *, MHEGColour *);
void MHEGCanvas_drawRectangle(MHEGCanvas *, XYPosition *, OriginalBoxSize *, int, int, MHEGColour *, MHEGColour *);
#endif /* __MHEGCANVAS_H__ */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-23 13:45:26
|
Revision: 254
http://svn.sourceforge.net/redbutton/?rev=254&view=rev
Author: skilvington
Date: 2007-03-23 06:45:24 -0700 (Fri, 23 Mar 2007)
Log Message:
-----------
DrawPolyline DynamicLineArtClass method
Modified Paths:
--------------
redbutton-browser/trunk/DynamicLineArtClass.c
redbutton-browser/trunk/MHEGCanvas.c
redbutton-browser/trunk/MHEGCanvas.h
Modified: redbutton-browser/trunk/DynamicLineArtClass.c
===================================================================
--- redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-22 17:42:27 UTC (rev 253)
+++ redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-23 13:45:24 UTC (rev 254)
@@ -626,10 +626,30 @@
void
DynamicLineArtClass_DrawPolyline(DynamicLineArtClass *t, DrawPolyline *params, OctetString *caller_gid)
{
+ LIST_OF(XYPosition) *xy_list = NULL;
+ LIST_TYPE(XYPosition) *xy;
+ LIST_TYPE(Point) *pt;
+
verbose("DynamicLineArtClass: %s; DrawPolyline", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_DrawPolyline not yet implemented\n");
+ for(pt=params->pointlist; pt; pt=pt->next)
+ {
+ xy = safe_malloc(sizeof(LIST_TYPE(XYPosition)));
+ xy->item.x_position = GenericInteger_getInteger(&pt->item.x, caller_gid);
+ xy->item.y_position = GenericInteger_getInteger(&pt->item.y, caller_gid);
+ LIST_APPEND(&xy_list, xy);
+ }
+
+ MHEGCanvas_drawPolyline(t->inst.canvas, xy_list,
+ t->inst.LineWidth, t->inst.LineStyle,
+ &t->inst.RefLineColour);
+
+ /* if it is active, redraw it */
+ if(t->rootClass.inst.RunningStatus)
+ MHEGEngine_redrawArea(&t->inst.Position, &t->inst.BoxSize);
+
+ LIST_FREE(&xy_list, XYPosition, safe_free);
+
return;
}
Modified: redbutton-browser/trunk/MHEGCanvas.c
===================================================================
--- redbutton-browser/trunk/MHEGCanvas.c 2007-03-22 17:42:27 UTC (rev 253)
+++ redbutton-browser/trunk/MHEGCanvas.c 2007-03-23 13:45:24 UTC (rev 254)
@@ -390,6 +390,60 @@
}
/*
+ * draw a set of joined lines
+ * the lines are drawn width pixels wide in the given colour
+ */
+
+void
+MHEGCanvas_drawPolyline(MHEGCanvas *c, LIST_OF(XYPosition) *xy_list, int width, int style, MHEGColour *colour)
+{
+ MHEGDisplay *d = MHEGEngine_getDisplay();
+ LIST_TYPE(XYPosition) *pos;
+ unsigned int nxpts;
+ XPoint *xpts;
+ unsigned int i;
+ XGCValues gcvals;
+
+ if(width <= 0)
+ return;
+
+ if(style != LineStyle_solid)
+ error("MHEGCanvas_drawPolyline: LineStyle %d not supported (using a solid line)", style);
+
+ /* scale up if fullscreen */
+ width = (width * d->xres) / MHEG_XRES;
+
+ /* convert the XYPosition list into an array of XPoint's */
+ nxpts = 0;
+ for(pos=xy_list; pos; pos=pos->next)
+ nxpts ++;
+
+ xpts = safe_malloc(nxpts * sizeof(XPoint));
+
+ pos = xy_list;
+ for(i=0; i<nxpts; i++)
+ {
+ /* scale up if fullscreen */
+ xpts[i].x = (pos->item.x_position * d->xres) / MHEG_XRES;
+ xpts[i].y = (pos->item.y_position * d->yres) / MHEG_YRES;
+ pos = pos->next;
+ }
+
+ /* set the line width and colour */
+ gcvals.foreground = pixel_value(c->pic_format, colour);
+ gcvals.line_width = width;
+ XChangeGC(d->dpy, c->gc, GCForeground | GCLineWidth, &gcvals);
+
+ /* draw it */
+ XDrawLines(d->dpy, c->contents, c->gc, xpts, nxpts, CoordModeOrigin);
+
+ /* clean up */
+ safe_free(xpts);
+
+ return;
+}
+
+/*
* draw a rectangle
* the outline is drawn width pixels wide (ie it may stick out of the box) in line_col
* it is filled with fill_col
Modified: redbutton-browser/trunk/MHEGCanvas.h
===================================================================
--- redbutton-browser/trunk/MHEGCanvas.h 2007-03-22 17:42:27 UTC (rev 253)
+++ redbutton-browser/trunk/MHEGCanvas.h 2007-03-23 13:45:24 UTC (rev 254)
@@ -30,6 +30,7 @@
void MHEGCanvas_drawLine(MHEGCanvas *, XYPosition *, XYPosition *, int, int, MHEGColour *);
void MHEGCanvas_drawOval(MHEGCanvas *, XYPosition *, OriginalBoxSize *, int, int, MHEGColour *, MHEGColour *);
void MHEGCanvas_drawPolygon(MHEGCanvas *, LIST_OF(XYPosition) *, int, int, MHEGColour *, MHEGColour *);
+void MHEGCanvas_drawPolyline(MHEGCanvas *, LIST_OF(XYPosition) *, int, int, MHEGColour *);
void MHEGCanvas_drawRectangle(MHEGCanvas *, XYPosition *, OriginalBoxSize *, int, int, MHEGColour *, MHEGColour *);
#endif /* __MHEGCANVAS_H__ */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-25 09:51:07
|
Revision: 258
http://svn.sourceforge.net/redbutton/?rev=258&view=rev
Author: skilvington
Date: 2007-03-25 02:51:05 -0700 (Sun, 25 Mar 2007)
Log Message:
-----------
don't send A/V streams through the IP stack if the backend and frontend are on the same host
Modified Paths:
--------------
redbutton-browser/trunk/MHEGBackend.c
redbutton-browser/trunk/MHEGBackend.h
redbutton-browser/trunk/MHEGEngine.c
redbutton-browser/trunk/MHEGEngine.h
redbutton-browser/trunk/MHEGStreamPlayer.c
redbutton-browser/trunk/MHEGStreamPlayer.h
Modified: redbutton-browser/trunk/MHEGBackend.c
===================================================================
--- redbutton-browser/trunk/MHEGBackend.c 2007-03-25 09:07:27 UTC (rev 257)
+++ redbutton-browser/trunk/MHEGBackend.c 2007-03-25 09:51:05 UTC (rev 258)
@@ -14,11 +14,22 @@
#include "si.h"
#include "utils.h"
+/* internal functions */
+static FILE *remote_command(MHEGBackend *, bool, char *);
+static unsigned int remote_response(FILE *);
+
+static MHEGStream *open_stream(MHEGBackend *, int, bool, int *, int *, bool, int *, int *);
+static void close_stream(MHEGBackend *, MHEGStream *);
+
+static int parse_addr(char *, struct in_addr *, in_port_t *);
+static int get_host_addr(char *, struct in_addr *);
+
+static char *external_filename(MHEGBackend *, OctetString *);
+
/* local backend funcs */
bool local_checkContentRef(MHEGBackend *, ContentReference *);
bool local_loadFile(MHEGBackend *, OctetString *, OctetString *);
FILE *local_openFile(MHEGBackend *, OctetString *);
-FILE *local_openStream(MHEGBackend *, int, bool, int *, int *, bool, int *, int *);
void local_retune(MHEGBackend *, OctetString *);
static struct MHEGBackendFns local_backend_fns =
@@ -26,7 +37,8 @@
local_checkContentRef, /* checkContentRef */
local_loadFile, /* loadFile */
local_openFile, /* openFile */
- local_openStream, /* openStream */
+ open_stream, /* openStream */
+ close_stream, /* closeStream */
local_retune, /* retune */
};
@@ -34,7 +46,6 @@
bool remote_checkContentRef(MHEGBackend *, ContentReference *);
bool remote_loadFile(MHEGBackend *, OctetString *, OctetString *);
FILE *remote_openFile(MHEGBackend *, OctetString *);
-FILE *remote_openStream(MHEGBackend *, int, bool, int *, int *, bool, int *, int *);
void remote_retune(MHEGBackend *, OctetString *);
static struct MHEGBackendFns remote_backend_fns =
@@ -42,19 +53,11 @@
remote_checkContentRef, /* checkContentRef */
remote_loadFile, /* loadFile */
remote_openFile, /* openFile */
- remote_openStream, /* openStream */
+ open_stream, /* openStream */
+ close_stream, /* closeStream */
remote_retune, /* retune */
};
-/* internal functions */
-static int parse_addr(char *, struct in_addr *, in_port_t *);
-static int get_host_addr(char *, struct in_addr *);
-
-static FILE *remote_command(MHEGBackend *, bool, char *);
-static unsigned int remote_response(FILE *);
-
-static char *external_filename(MHEGBackend *, OctetString *);
-
/* public interface */
void
MHEGBackend_init(MHEGBackend *b, bool remote, char *srg_loc)
@@ -103,60 +106,6 @@
}
/*
- * extract the IP addr and port number from a string in one of these forms:
- * host:port
- * ip-addr:port
- * host
- * ip-addr
- * if the port is not defined in the string, the value passed to this routine is unchanged
- * ip and port are both returned in network byte order
- * returns -1 on error (can't resolve host name)
- */
-
-static int
-parse_addr(char *str, struct in_addr *ip, in_port_t *port)
-{
- char *p;
-
- if((p = strchr(str, ':')) != NULL)
- {
- /* its either host:port or ip:port */
- *(p++) = '\0';
- if(get_host_addr(str, ip) < 0)
- return -1;
- *port = htons(atoi(p));
- /* reconstruct the string */
- *(--p) = ':';
- }
- else if(get_host_addr(str, ip) < 0)
- {
- return -1;
- }
-
- return 0;
-}
-
-/*
- * puts the IP address associated with the given host into output buffer
- * host can be a.b.c.d or a host name
- * returns 0 if successful, -1 on error
- */
-
-static int
-get_host_addr(char *host, struct in_addr *output)
-{
- struct hostent *he;
- int error = 0;
-
- if(((he = gethostbyname(host)) != NULL) && (he->h_addrtype == AF_INET))
- memcpy(output, he->h_addr, sizeof(struct in_addr));
- else
- error = -1;
-
- return error;
-}
-
-/*
* send the given command to the remote backend
* if reuse is true, reuse the existing connection to the backend
* returns a socket FILE to read the response from
@@ -232,6 +181,193 @@
}
/*
+ * return a read-only FILE handle for an MPEG Transport Stream (in MHEGStream->ts)
+ * the TS will contain an audio stream (if have_audio is true) and a video stream (if have_video is true)
+ * the *audio_tag and *video_tag numbers refer to Component/Association Tag values from the DVB PMT
+ * if *audio_tag or *video_tag is -1, the default audio and/or video stream for the given Service ID is used
+ * if service_id is -1, it uses the Service ID we are downloading the carousel from
+ * updates *audio_tag and/or *video_tag to the actual PIDs in the Transport Stream
+ * updates *audio_type and/or *video_type to the stream type IDs
+ * returns NULL on error
+ */
+
+static MHEGStream *
+open_stream(MHEGBackend *t,
+ int service_id,
+ bool have_audio, int *audio_tag, int *audio_type,
+ bool have_video, int *video_tag, int *video_type)
+{
+ MHEGStream *stream;
+ bool loopback;
+ char *avcmd;
+ char cmd[PATH_MAX];
+ FILE *be;
+ char pids[PATH_MAX];
+ unsigned int audio_pid = 0;
+ unsigned int video_pid = 0;
+ bool err;
+ char *ts_dev;
+
+ /* are the backend and frontend on the same host */
+ loopback = (t->addr.sin_addr.s_addr == htonl(INADDR_LOOPBACK));
+ if(loopback)
+ avcmd = "demux";
+ else
+ avcmd = "stream";
+
+ /* no PIDs required */
+ if(!have_audio && !have_video)
+ return NULL;
+ /* video and audio */
+ else if(have_audio && have_video)
+ snprintf(cmd, sizeof(cmd), "av%s %d %d %d\n", avcmd, service_id, *audio_tag, *video_tag);
+ /* audio only */
+ else if(have_audio)
+ snprintf(cmd, sizeof(cmd), "a%s %d %d\n", avcmd, service_id, *audio_tag);
+ /* video only */
+ else
+ snprintf(cmd, sizeof(cmd), "v%s %d %d\n", avcmd, service_id, *video_tag);
+
+ /* false => create a new connection to the backend */
+ if((be = remote_command(t, false, cmd)) == NULL)
+ return NULL;
+
+ /* did it work */
+ if(remote_response(be) != BACKEND_RESPONSE_OK
+ || fgets(pids, sizeof(pids), be) == NULL)
+ {
+ fclose(be);
+ return NULL;
+ }
+
+ /* update the PID variables */
+ if(have_audio && have_video)
+ err = (sscanf(pids, "AudioPID %u AudioType %u VideoPID %u VideoType %u",
+ &audio_pid, audio_type, &video_pid, video_type) != 4);
+ else if(have_audio)
+ err = (sscanf(pids, "AudioPID %u AudioType %u", &audio_pid, audio_type) != 2);
+ else
+ err = (sscanf(pids, "VideoPID %u VideoType %u", &video_pid, video_type) != 2);
+
+ if(err)
+ {
+ fclose(be);
+ return NULL;
+ }
+
+ if(have_audio)
+ *audio_tag = audio_pid;
+ if(have_video)
+ *video_tag = video_pid;
+
+ /* set up the MHEGStream */
+ stream = safe_malloc(sizeof(MHEGStream));
+
+ /*
+ * if we sent a "demux" command, open the DVR device
+ * if we sent a "stream" command, the TS is streamed from the backend
+ */
+ if(loopback)
+ {
+ /* backend tells us where the DVR device is */
+ if(fgets(pids, sizeof(pids), be) == NULL
+ || strncmp(pids, "Device ", 7) != 0)
+ {
+ fclose(be);
+ safe_free(stream);
+ return NULL;
+ }
+ ts_dev = pids + 7;
+ if((stream->ts = fopen(ts_dev, "r")) == NULL)
+ {
+ fclose(be);
+ safe_free(stream);
+ return NULL;
+ }
+ /* backend keeps the PID filters in place until we close this connection */
+ stream->demux = be;
+ }
+ else
+ {
+ stream->ts = be;
+ stream->demux = NULL;
+ }
+
+ return stream;
+}
+
+static void
+close_stream(MHEGBackend *t, MHEGStream *stream)
+{
+ if(stream == NULL)
+ return;
+
+ if(stream->ts != NULL)
+ fclose(stream->ts);
+
+ if(stream->demux != NULL)
+ fclose(stream->demux);
+
+ safe_free(stream);
+
+ return;
+}
+
+/*
+ * extract the IP addr and port number from a string in one of these forms:
+ * host:port
+ * ip-addr:port
+ * host
+ * ip-addr
+ * if the port is not defined in the string, the value passed to this routine is unchanged
+ * ip and port are both returned in network byte order
+ * returns -1 on error (can't resolve host name)
+ */
+
+static int
+parse_addr(char *str, struct in_addr *ip, in_port_t *port)
+{
+ char *p;
+
+ if((p = strchr(str, ':')) != NULL)
+ {
+ /* its either host:port or ip:port */
+ *(p++) = '\0';
+ if(get_host_addr(str, ip) < 0)
+ return -1;
+ *port = htons(atoi(p));
+ /* reconstruct the string */
+ *(--p) = ':';
+ }
+ else if(get_host_addr(str, ip) < 0)
+ {
+ return -1;
+ }
+
+ return 0;
+}
+
+/*
+ * puts the IP address associated with the given host into output buffer
+ * host can be a.b.c.d or a host name
+ * returns 0 if successful, -1 on error
+ */
+
+static int
+get_host_addr(char *host, struct in_addr *output)
+{
+ struct hostent *he;
+ int error = 0;
+
+ if(((he = gethostbyname(host)) != NULL) && (he->h_addrtype == AF_INET))
+ memcpy(output, he->h_addr, sizeof(struct in_addr));
+ else
+ error = -1;
+
+ return error;
+}
+
+/*
* returns a filename that can be loaded from the file system
* ie ~// at the start of the absolute name is replaced with base_dir
* returns a ptr to a static string that will be overwritten by the next call to this routine
@@ -330,31 +466,6 @@
}
/*
- * return a read-only FILE handle for an MPEG Transport Stream
- * the TS will contain an audio stream (if have_audio is true) and a video stream (if have_video is true)
- * the *audio_tag and *video_tag numbers refer to Component/Association Tag values from the DVB PMT
- * if *audio_tag or *video_tag is -1, the default audio and/or video stream for the given Service ID is used
- * if service_id is -1, it uses the Service ID we are downloading the carousel from
- * updates *audio_tag and/or *video_tag to the actual PIDs in the Transport Stream
- * updates *audio_type and/or *video_type to the stream type IDs
- * returns NULL on error
- */
-
-FILE *
-local_openStream(MHEGBackend *t, int service_id, bool have_audio, int *audio_tag, int *audio_type, bool have_video, int *video_tag, int *video_type)
-{
- /*
- * we need to convert the audio/video_tag into PIDs
- * we could either:
- * 1. parse the PMT ourselves, and open the DVB device ourselves
- * 2. have a backend command to convert Component Tags to PIDs, then open the DVB device ourselves
- * 3. just stream the TS from the backend
- * we choose 3, to avoid duplicating code and having to pass "-d <device>" options etc
- */
- return remote_openStream(t, service_id, have_audio, audio_tag, audio_type, have_video, video_tag, video_type);
-}
-
-/*
* retune the backend to the given service
* service should be in the form "dvb://<network_id>..<service_id>", eg "dvb://233a..4C80"
*/
@@ -520,77 +631,6 @@
}
/*
- * return a read-only FILE handle for an MPEG Transport Stream
- * the TS will contain an audio stream (if have_audio is true) and a video stream (if have_video is true)
- * the *audio_tag and *video_tag numbers refer to Component/Association Tag values from the DVB PMT
- * if *audio_tag or *video_tag is -1, the default audio and/or video stream for the given Service ID is used
- * if service_id is -1, it uses the Service ID we are downloading the carousel from
- * updates *audio_tag and/or *video_tag to the actual PIDs in the Transport Stream
- * updates *audio_type and/or *video_type to the stream type IDs
- * returns NULL on error
- */
-
-FILE *
-remote_openStream(MHEGBackend *t, int service_id, bool have_audio, int *audio_tag, int *audio_type, bool have_video, int *video_tag, int *video_type)
-{
- char cmd[PATH_MAX];
- FILE *sock;
- char pids[128];
- unsigned int audio_pid = 0;
- unsigned int video_pid = 0;
- bool err;
-
- /* no PIDs required */
- if(!have_audio && !have_video)
- return NULL;
- /* video and audio */
- else if(have_audio && have_video)
- snprintf(cmd, sizeof(cmd), "avstream %d %d %d\n", service_id, *audio_tag, *video_tag);
- /* audio only */
- else if(have_audio)
- snprintf(cmd, sizeof(cmd), "astream %d %d\n", service_id, *audio_tag);
- /* video only */
- else
- snprintf(cmd, sizeof(cmd), "vstream %d %d\n", service_id, *video_tag);
-
- /* false => create a new connection to the backend */
- if((sock = remote_command(t, false, cmd)) == NULL)
- return NULL;
-
- /* did it work */
- if(remote_response(sock) != BACKEND_RESPONSE_OK
- || fgets(pids, sizeof(pids), sock) == NULL)
- {
- fclose(sock);
- return NULL;
- }
-
- /* update the PID variables */
- if(have_audio && have_video)
- err = (sscanf(pids, "AudioPID %u AudioType %u VideoPID %u VideoType %u",
- &audio_pid, audio_type, &video_pid, video_type) != 4);
- else if(have_audio)
- err = (sscanf(pids, "AudioPID %u AudioType %u", &audio_pid, audio_type) != 2);
- else
- err = (sscanf(pids, "VideoPID %u VideoType %u", &video_pid, video_type) != 2);
-
- if(!err)
- {
- if(have_audio)
- *audio_tag = audio_pid;
- if(have_video)
- *video_tag = video_pid;
- }
- else
- {
- fclose(sock);
- sock = NULL;
- }
-
- return sock;
-}
-
-/*
* retune the backend to the given service
* service should be in the form "dvb://<network_id>..<service_id>", eg "dvb://233a..4C80"
*/
Modified: redbutton-browser/trunk/MHEGBackend.h
===================================================================
--- redbutton-browser/trunk/MHEGBackend.h 2007-03-25 09:07:27 UTC (rev 257)
+++ redbutton-browser/trunk/MHEGBackend.h 2007-03-25 09:51:05 UTC (rev 258)
@@ -14,6 +14,13 @@
#define DEFAULT_BACKEND "127.0.0.1"
+/* MPEG Transport Stream */
+typedef struct
+{
+ FILE *ts; /* the Transport Stream */
+ FILE *demux; /* private */
+} MHEGStream;
+
typedef struct MHEGBackend
{
char *base_dir; /* local Service Gateway root directory */
@@ -29,7 +36,9 @@
/* open a carousel file */
FILE *(*openFile)(struct MHEGBackend *, OctetString *);
/* open an MPEG Transport Stream */
- FILE *(*openStream)(struct MHEGBackend *, int, bool, int *, int *, bool, int *, int *);
+ MHEGStream *(*openStream)(struct MHEGBackend *, int, bool, int *, int *, bool, int *, int *);
+ /* close an MPEG Transport Stream */
+ void (*closeStream)(struct MHEGBackend *, MHEGStream *);
/* tune to the given service */
void (*retune)(struct MHEGBackend *, OctetString *);
} *fns;
Modified: redbutton-browser/trunk/MHEGEngine.c
===================================================================
--- redbutton-browser/trunk/MHEGEngine.c 2007-03-25 09:07:27 UTC (rev 257)
+++ redbutton-browser/trunk/MHEGEngine.c 2007-03-25 09:51:05 UTC (rev 258)
@@ -1415,7 +1415,7 @@
* returns NULL on error
*/
-FILE *
+MHEGStream *
MHEGEngine_openStream(int service_id, bool have_audio, int *audio_tag, int *audio_type, bool have_video, int *video_tag, int *video_type)
{
return (*(engine.backend.fns->openStream))(&engine.backend,
@@ -1424,6 +1424,12 @@
have_video, video_tag, video_type);
}
+void
+MHEGEngine_closeStream(MHEGStream *stream)
+{
+ return (*(engine.backend.fns->closeStream))(&engine.backend, stream);
+}
+
/*
* retune the backend to the given service
* service should be in the form "dvb://<network_id>..<service_id>", eg "dvb://233a..4C80"
Modified: redbutton-browser/trunk/MHEGEngine.h
===================================================================
--- redbutton-browser/trunk/MHEGEngine.h 2007-03-25 09:07:27 UTC (rev 257)
+++ redbutton-browser/trunk/MHEGEngine.h 2007-03-25 09:51:05 UTC (rev 258)
@@ -239,7 +239,8 @@
bool MHEGEngine_checkContentRef(ContentReference *);
bool MHEGEngine_loadFile(OctetString *, OctetString *);
FILE *MHEGEngine_openFile(OctetString *);
-FILE *MHEGEngine_openStream(int, bool, int *, int *, bool, int *, int *);
+MHEGStream *MHEGEngine_openStream(int, bool, int *, int *, bool, int *, int *);
+void MHEGEngine_closeStream(MHEGStream *);
void MHEGEngine_retune(OctetString *);
char *MHEGEngine_absoluteFilename(OctetString *);
Modified: redbutton-browser/trunk/MHEGStreamPlayer.c
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.c 2007-03-25 09:07:27 UTC (rev 257)
+++ redbutton-browser/trunk/MHEGStreamPlayer.c 2007-03-25 09:51:05 UTC (rev 258)
@@ -342,7 +342,7 @@
if(p->ts != NULL)
{
- fclose(p->ts);
+ MHEGEngine_closeStream(p->ts);
p->ts = NULL;
}
@@ -415,10 +415,10 @@
demux_apid = p->have_audio ? p->audio_pid : -1;
demux_vpid = p->have_video ? p->video_pid : -1;
- if((tsdemux = mpegts_open(p->ts, demux_apid, demux_vpid)) == NULL)
+ if((tsdemux = mpegts_open(p->ts->ts, demux_apid, demux_vpid)) == NULL)
fatal("Out of memory");
- while(!p->stop && !feof(p->ts))
+ while(!p->stop && !feof(p->ts->ts))
{
/* get the next complete packet for one of the streams */
if(mpegts_demux_frame(tsdemux, &pkt) < 0)
Modified: redbutton-browser/trunk/MHEGStreamPlayer.h
===================================================================
--- redbutton-browser/trunk/MHEGStreamPlayer.h 2007-03-25 09:07:27 UTC (rev 257)
+++ redbutton-browser/trunk/MHEGStreamPlayer.h 2007-03-25 09:51:05 UTC (rev 258)
@@ -12,6 +12,7 @@
#include <ffmpeg/avcodec.h>
#include "ISO13522-MHEG-5.h"
+#include "MHEGBackend.h"
/* seconds of video to buffer before we start playing it */
#define INIT_VIDEO_BUFFER_WAIT 1.0
@@ -66,7 +67,7 @@
int audio_pid; /* PID in MPEG Transport Stream (-1 => not yet known) */
int audio_type; /* audio stream type (-1 => not yet known) */
AVCodecContext *audio_codec; /* audio ouput params */
- FILE *ts; /* MPEG Transport Stream */
+ MHEGStream *ts; /* MPEG Transport Stream */
pthread_t decode_tid; /* thread decoding the MPEG stream into audio/video frames */
pthread_t video_tid; /* thread displaying video frames on the screen */
pthread_t audio_tid; /* thread feeding audio frames into the sound card */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-25 17:52:10
|
Revision: 259
http://svn.sourceforge.net/redbutton/?rev=259&view=rev
Author: skilvington
Date: 2007-03-25 10:52:09 -0700 (Sun, 25 Mar 2007)
Log Message:
-----------
get the dvr device name right
Modified Paths:
--------------
redbutton-browser/trunk/MHEGBackend.c
redbutton-browser/trunk/TODO
Modified: redbutton-browser/trunk/MHEGBackend.c
===================================================================
--- redbutton-browser/trunk/MHEGBackend.c 2007-03-25 09:51:05 UTC (rev 258)
+++ redbutton-browser/trunk/MHEGBackend.c 2007-03-25 17:52:09 UTC (rev 259)
@@ -207,6 +207,7 @@
unsigned int video_pid = 0;
bool err;
char *ts_dev;
+ int tail;
/* are the backend and frontend on the same host */
loopback = (t->addr.sin_addr.s_addr == htonl(INADDR_LOOPBACK));
@@ -278,6 +279,10 @@
return NULL;
}
ts_dev = pids + 7;
+ /* chop off any trailing \n */
+ tail = strlen(ts_dev) - 1;
+ while(tail > 0 && ts_dev[tail] == '\n')
+ ts_dev[tail--] = '\0';
if((stream->ts = fopen(ts_dev, "r")) == NULL)
{
fclose(be);
Modified: redbutton-browser/trunk/TODO
===================================================================
--- redbutton-browser/trunk/TODO 2007-03-25 09:51:05 UTC (rev 258)
+++ redbutton-browser/trunk/TODO 2007-03-25 17:52:09 UTC (rev 259)
@@ -1,9 +1,3 @@
-openStream:
-if "remote" backend is 127.0.0.1, open dvr device in rb-browser
-- ask rb-download to set the PID filters, it returns the dvr dev name
-- when connection is closed, rb-download clears filters
-
-
posix_fadvise() when streaming data from the backend?
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-28 14:16:23
|
Revision: 261
http://svn.sourceforge.net/redbutton/?rev=261&view=rev
Author: skilvington
Date: 2007-03-28 07:16:19 -0700 (Wed, 28 Mar 2007)
Log Message:
-----------
SetData can't be applied to objects with no ContentHook attribute
Modified Paths:
--------------
redbutton-browser/trunk/BooleanVariableClass.c
redbutton-browser/trunk/BooleanVariableClass.h
redbutton-browser/trunk/ContentRefVariableClass.c
redbutton-browser/trunk/ContentRefVariableClass.h
redbutton-browser/trunk/ElementaryAction.c
redbutton-browser/trunk/IntegerVariableClass.c
redbutton-browser/trunk/IntegerVariableClass.h
redbutton-browser/trunk/LinkClass.c
redbutton-browser/trunk/LinkClass.h
redbutton-browser/trunk/ObjectRefVariableClass.c
redbutton-browser/trunk/ObjectRefVariableClass.h
redbutton-browser/trunk/OctetStringVariableClass.c
redbutton-browser/trunk/OctetStringVariableClass.h
redbutton-browser/trunk/VariableClass.c
redbutton-browser/trunk/VariableClass.h
Modified: redbutton-browser/trunk/BooleanVariableClass.c
===================================================================
--- redbutton-browser/trunk/BooleanVariableClass.c 2007-03-26 12:48:39 UTC (rev 260)
+++ redbutton-browser/trunk/BooleanVariableClass.c 2007-03-28 14:16:19 UTC (rev 261)
@@ -13,16 +13,6 @@
#include "rtti.h"
void
-BooleanVariableClass_SetData(BooleanVariableClass *t, SetData *params, OctetString *caller_gid)
-{
- verbose("BooleanVariableClass: %s; SetData", ExternalReference_name(&t->rootClass.inst.ref));
-
-/* TODO */
-printf("TODO: BooleanVariableClass_SetData not yet implemented\n");
- return;
-}
-
-void
BooleanVariableClass_Clone(BooleanVariableClass *t, Clone *params, OctetString *caller_gid)
{
verbose("BooleanVariableClass: %s; Clone", ExternalReference_name(&t->rootClass.inst.ref));
Modified: redbutton-browser/trunk/BooleanVariableClass.h
===================================================================
--- redbutton-browser/trunk/BooleanVariableClass.h 2007-03-26 12:48:39 UTC (rev 260)
+++ redbutton-browser/trunk/BooleanVariableClass.h 2007-03-28 14:16:19 UTC (rev 261)
@@ -7,7 +7,6 @@
#include "ISO13522-MHEG-5.h"
-void BooleanVariableClass_SetData(BooleanVariableClass *, SetData *, OctetString *);
void BooleanVariableClass_Clone(BooleanVariableClass *, Clone *, OctetString *);
void BooleanVariableClass_SetVariable(BooleanVariableClass *, NewVariableValue *, OctetString *);
void BooleanVariableClass_TestVariable(BooleanVariableClass *, int, bool);
Modified: redbutton-browser/trunk/ContentRefVariableClass.c
===================================================================
--- redbutton-browser/trunk/ContentRefVariableClass.c 2007-03-26 12:48:39 UTC (rev 260)
+++ redbutton-browser/trunk/ContentRefVariableClass.c 2007-03-28 14:16:19 UTC (rev 261)
@@ -13,16 +13,6 @@
#include "rtti.h"
void
-ContentRefVariableClass_SetData(ContentRefVariableClass *t, SetData *params, OctetString *caller_gid)
-{
- verbose("ContentRefVariableClass: %s; SetData", ExternalReference_name(&t->rootClass.inst.ref));
-
-/* TODO */
-printf("TODO: ContentRefVariableClass_SetData not yet implemented\n");
- return;
-}
-
-void
ContentRefVariableClass_Clone(ContentRefVariableClass *t, Clone *params, OctetString *caller_gid)
{
verbose("ContentRefVariableClass: %s; Clone", ExternalReference_name(&t->rootClass.inst.ref));
Modified: redbutton-browser/trunk/ContentRefVariableClass.h
===================================================================
--- redbutton-browser/trunk/ContentRefVariableClass.h 2007-03-26 12:48:39 UTC (rev 260)
+++ redbutton-browser/trunk/ContentRefVariableClass.h 2007-03-28 14:16:19 UTC (rev 261)
@@ -7,7 +7,6 @@
#include "ISO13522-MHEG-5.h"
-void ContentRefVariableClass_SetData(ContentRefVariableClass *, SetData *, OctetString *);
void ContentRefVariableClass_Clone(ContentRefVariableClass *, Clone *, OctetString *);
void ContentRefVariableClass_SetVariable(ContentRefVariableClass *, NewVariableValue *, OctetString *);
void ContentRefVariableClass_TestVariable(ContentRefVariableClass *, int, ContentReference *);
Modified: redbutton-browser/trunk/ElementaryAction.c
===================================================================
--- redbutton-browser/trunk/ElementaryAction.c 2007-03-26 12:48:39 UTC (rev 260)
+++ redbutton-browser/trunk/ElementaryAction.c 2007-03-28 14:16:19 UTC (rev 261)
@@ -1183,11 +1183,7 @@
if(((ref = GenericObjectReference_getObjectReference(&e->u.set_data.target, caller_gid)) != NULL)
&& ((obj = MHEGEngine_findObjectReference(ref, caller_gid)) != NULL))
{
- if(obj->inst.rtti == RTTI_VariableClass)
- VariableClass_SetData((VariableClass *) obj, &e->u.set_data, caller_gid);
- else if(obj->inst.rtti == RTTI_LinkClass)
- LinkClass_SetData((LinkClass *) obj, &e->u.set_data, caller_gid);
- else if(obj->inst.rtti == RTTI_BitmapClass)
+ if(obj->inst.rtti == RTTI_BitmapClass)
BitmapClass_SetData((BitmapClass *) obj, &e->u.set_data, caller_gid);
else if(obj->inst.rtti == RTTI_DynamicLineArtClass)
DynamicLineArtClass_SetData((DynamicLineArtClass *) obj, &e->u.set_data, caller_gid);
Modified: redbutton-browser/trunk/IntegerVariableClass.c
===================================================================
--- redbutton-browser/trunk/IntegerVariableClass.c 2007-03-26 12:48:39 UTC (rev 260)
+++ redbutton-browser/trunk/IntegerVariableClass.c 2007-03-28 14:16:19 UTC (rev 261)
@@ -16,16 +16,6 @@
#include "rtti.h"
void
-IntegerVariableClass_SetData(IntegerVariableClass *t, SetData *params, OctetString *caller_gid)
-{
- verbose("IntegerVariableClass: %s; SetData", ExternalReference_name(&t->rootClass.inst.ref));
-
-/* TODO */
-printf("TODO: IntegerVariableClass_SetData not yet implemented\n");
- return;
-}
-
-void
IntegerVariableClass_Clone(IntegerVariableClass *t, Clone *params, OctetString *caller_gid)
{
verbose("IntegerVariableClass: %s; Clone", ExternalReference_name(&t->rootClass.inst.ref));
Modified: redbutton-browser/trunk/IntegerVariableClass.h
===================================================================
--- redbutton-browser/trunk/IntegerVariableClass.h 2007-03-26 12:48:39 UTC (rev 260)
+++ redbutton-browser/trunk/IntegerVariableClass.h 2007-03-28 14:16:19 UTC (rev 261)
@@ -7,7 +7,6 @@
#include "ISO13522-MHEG-5.h"
-void IntegerVariableClass_SetData(IntegerVariableClass *, SetData *, OctetString *);
void IntegerVariableClass_Clone(IntegerVariableClass *, Clone *, OctetString *);
void IntegerVariableClass_SetVariable(IntegerVariableClass *, NewVariableValue *, OctetString *);
void IntegerVariableClass_TestVariable(IntegerVariableClass *, int, int);
Modified: redbutton-browser/trunk/LinkClass.c
===================================================================
--- redbutton-browser/trunk/LinkClass.c 2007-03-26 12:48:39 UTC (rev 260)
+++ redbutton-browser/trunk/LinkClass.c 2007-03-28 14:16:19 UTC (rev 261)
@@ -87,16 +87,6 @@
}
void
-LinkClass_SetData(LinkClass *t, SetData *set, OctetString *caller_gid)
-{
- verbose("LinkClass: %s; SetData", ExternalReference_name(&t->rootClass.inst.ref));
-
-/* TODO */
-printf("TODO: LinkClass_SetData not yet implemented\n");
- return;
-}
-
-void
LinkClass_Clone(LinkClass *t, Clone *params, OctetString *caller_gid)
{
verbose("LinkClass: %s; Clone", ExternalReference_name(&t->rootClass.inst.ref));
Modified: redbutton-browser/trunk/LinkClass.h
===================================================================
--- redbutton-browser/trunk/LinkClass.h 2007-03-26 12:48:39 UTC (rev 260)
+++ redbutton-browser/trunk/LinkClass.h 2007-03-28 14:16:19 UTC (rev 261)
@@ -12,7 +12,6 @@
void LinkClass_Deactivation(LinkClass *);
void LinkClass_Destruction(LinkClass *);
-void LinkClass_SetData(LinkClass *, SetData *, OctetString *);
void LinkClass_Clone(LinkClass *, Clone *, OctetString *);
void LinkClass_Activate(LinkClass *);
void LinkClass_Deactivate(LinkClass *);
Modified: redbutton-browser/trunk/ObjectRefVariableClass.c
===================================================================
--- redbutton-browser/trunk/ObjectRefVariableClass.c 2007-03-26 12:48:39 UTC (rev 260)
+++ redbutton-browser/trunk/ObjectRefVariableClass.c 2007-03-28 14:16:19 UTC (rev 261)
@@ -13,16 +13,6 @@
#include "rtti.h"
void
-ObjectRefVariableClass_SetData(ObjectRefVariableClass *t, SetData *params, OctetString *caller_gid)
-{
- verbose("ObjectRefVariableClass: %s; SetData", ExternalReference_name(&t->rootClass.inst.ref));
-
-/* TODO */
-printf("TODO: ObjectRefVariableClass_SetData not yet implemented\n");
- return;
-}
-
-void
ObjectRefVariableClass_Clone(ObjectRefVariableClass *t, Clone *params, OctetString *caller_gid)
{
verbose("ObjectRefVariableClass: %s; Clone", ExternalReference_name(&t->rootClass.inst.ref));
Modified: redbutton-browser/trunk/ObjectRefVariableClass.h
===================================================================
--- redbutton-browser/trunk/ObjectRefVariableClass.h 2007-03-26 12:48:39 UTC (rev 260)
+++ redbutton-browser/trunk/ObjectRefVariableClass.h 2007-03-28 14:16:19 UTC (rev 261)
@@ -7,7 +7,6 @@
#include "ISO13522-MHEG-5.h"
-void ObjectRefVariableClass_SetData(ObjectRefVariableClass *, SetData *, OctetString *);
void ObjectRefVariableClass_Clone(ObjectRefVariableClass *, Clone *, OctetString *);
void ObjectRefVariableClass_SetVariable(ObjectRefVariableClass *, NewVariableValue *, OctetString *);
void ObjectRefVariableClass_TestVariable(ObjectRefVariableClass *, int, ObjectReference *, OctetString *);
Modified: redbutton-browser/trunk/OctetStringVariableClass.c
===================================================================
--- redbutton-browser/trunk/OctetStringVariableClass.c 2007-03-26 12:48:39 UTC (rev 260)
+++ redbutton-browser/trunk/OctetStringVariableClass.c 2007-03-28 14:16:19 UTC (rev 261)
@@ -17,16 +17,6 @@
#include "rtti.h"
void
-OctetStringVariableClass_SetData(OctetStringVariableClass *t, SetData *params, OctetString *caller_gid)
-{
- verbose("OctetStringVariableClass: %s; SetData", ExternalReference_name(&t->rootClass.inst.ref));
-
-/* TODO */
-printf("TODO: OctetStringVariableClass_SetData not yet implemented\n");
- return;
-}
-
-void
OctetStringVariableClass_Clone(OctetStringVariableClass *t, Clone *params, OctetString *caller_gid)
{
verbose("OctetStringVariableClass: %s; Clone", ExternalReference_name(&t->rootClass.inst.ref));
Modified: redbutton-browser/trunk/OctetStringVariableClass.h
===================================================================
--- redbutton-browser/trunk/OctetStringVariableClass.h 2007-03-26 12:48:39 UTC (rev 260)
+++ redbutton-browser/trunk/OctetStringVariableClass.h 2007-03-28 14:16:19 UTC (rev 261)
@@ -7,7 +7,6 @@
#include "ISO13522-MHEG-5.h"
-void OctetStringVariableClass_SetData(OctetStringVariableClass *, SetData *, OctetString *);
void OctetStringVariableClass_Clone(OctetStringVariableClass *, Clone *, OctetString *);
void OctetStringVariableClass_SetVariable(OctetStringVariableClass *, NewVariableValue *, OctetString *);
void OctetStringVariableClass_TestVariable(OctetStringVariableClass *, int, OctetString *);
Modified: redbutton-browser/trunk/VariableClass.c
===================================================================
--- redbutton-browser/trunk/VariableClass.c 2007-03-26 12:48:39 UTC (rev 260)
+++ redbutton-browser/trunk/VariableClass.c 2007-03-28 14:16:19 UTC (rev 261)
@@ -97,17 +97,6 @@
}
void
-VariableClass_SetData(VariableClass *t, SetData *set, OctetString *caller_gid)
-{
- verbose("VariableClass: %s; SetData", ExternalReference_name(&t->rootClass.inst.ref));
-
-/* TODO */
-/* do we need the separate Boolean/Integer/etc/VariableClass_SetData funcs we have created? */
-printf("TODO: VariableClass_SetData not yet implemented\n");
- return;
-}
-
-void
VariableClass_Clone(VariableClass *t, Clone *clone, OctetString *caller_gid)
{
switch(t->inst.Value.choice)
Modified: redbutton-browser/trunk/VariableClass.h
===================================================================
--- redbutton-browser/trunk/VariableClass.h 2007-03-26 12:48:39 UTC (rev 260)
+++ redbutton-browser/trunk/VariableClass.h 2007-03-28 14:16:19 UTC (rev 261)
@@ -12,7 +12,6 @@
void VariableClass_Deactivation(VariableClass *);
void VariableClass_Destruction(VariableClass *);
-void VariableClass_SetData(VariableClass *, SetData *, OctetString *);
void VariableClass_Clone(VariableClass *, Clone *, OctetString *);
void VariableClass_SetVariable(VariableClass *, NewVariableValue *, OctetString *);
void VariableClass_TestVariable(VariableClass *, int, ComparisonValue *, OctetString *);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-28 14:30:31
|
Revision: 262
http://svn.sourceforge.net/redbutton/?rev=262&view=rev
Author: skilvington
Date: 2007-03-28 07:30:28 -0700 (Wed, 28 Mar 2007)
Log Message:
-----------
the remaining objects with no ContentHook
Modified Paths:
--------------
redbutton-browser/trunk/DynamicLineArtClass.c
redbutton-browser/trunk/DynamicLineArtClass.h
redbutton-browser/trunk/ElementaryAction.c
redbutton-browser/trunk/ListGroupClass.c
redbutton-browser/trunk/ListGroupClass.h
redbutton-browser/trunk/RectangleClass.c
redbutton-browser/trunk/RectangleClass.h
redbutton-browser/trunk/SliderClass.c
redbutton-browser/trunk/SliderClass.h
redbutton-browser/trunk/TokenGroupClass.c
redbutton-browser/trunk/TokenGroupClass.h
Modified: redbutton-browser/trunk/DynamicLineArtClass.c
===================================================================
--- redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-28 14:16:19 UTC (rev 261)
+++ redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-28 14:30:28 UTC (rev 262)
@@ -112,16 +112,6 @@
}
void
-DynamicLineArtClass_SetData(DynamicLineArtClass *t, SetData *set, OctetString *caller_gid)
-{
- verbose("DynamicLineArtClass: %s; SetData", ExternalReference_name(&t->rootClass.inst.ref));
-
-/* TODO */
-printf("TODO: DynamicLineArtClass_SetData not yet implemented\n");
- return;
-}
-
-void
DynamicLineArtClass_Clone(DynamicLineArtClass *t, Clone *params, OctetString *caller_gid)
{
verbose("DynamicLineArtClass: %s; Clone", ExternalReference_name(&t->rootClass.inst.ref));
Modified: redbutton-browser/trunk/DynamicLineArtClass.h
===================================================================
--- redbutton-browser/trunk/DynamicLineArtClass.h 2007-03-28 14:16:19 UTC (rev 261)
+++ redbutton-browser/trunk/DynamicLineArtClass.h 2007-03-28 14:30:28 UTC (rev 262)
@@ -12,7 +12,6 @@
void DynamicLineArtClass_Deactivation(DynamicLineArtClass *);
void DynamicLineArtClass_Destruction(DynamicLineArtClass *);
-void DynamicLineArtClass_SetData(DynamicLineArtClass *, SetData *, OctetString *);
void DynamicLineArtClass_Clone(DynamicLineArtClass *, Clone *, OctetString *);
void DynamicLineArtClass_SetPosition(DynamicLineArtClass *, SetPosition *, OctetString *);
void DynamicLineArtClass_GetPosition(DynamicLineArtClass *, GetPosition *, OctetString *);
Modified: redbutton-browser/trunk/ElementaryAction.c
===================================================================
--- redbutton-browser/trunk/ElementaryAction.c 2007-03-28 14:16:19 UTC (rev 261)
+++ redbutton-browser/trunk/ElementaryAction.c 2007-03-28 14:30:28 UTC (rev 262)
@@ -1185,22 +1185,12 @@
{
if(obj->inst.rtti == RTTI_BitmapClass)
BitmapClass_SetData((BitmapClass *) obj, &e->u.set_data, caller_gid);
- else if(obj->inst.rtti == RTTI_DynamicLineArtClass)
- DynamicLineArtClass_SetData((DynamicLineArtClass *) obj, &e->u.set_data, caller_gid);
- else if(obj->inst.rtti == RTTI_RectangleClass)
- RectangleClass_SetData((RectangleClass *) obj, &e->u.set_data, caller_gid);
else if(obj->inst.rtti == RTTI_TextClass)
TextClass_SetData((TextClass *) obj, &e->u.set_data, caller_gid);
else if(obj->inst.rtti == RTTI_EntryFieldClass)
EntryFieldClass_SetData((EntryFieldClass *) obj, &e->u.set_data, caller_gid);
else if(obj->inst.rtti == RTTI_HyperTextClass)
HyperTextClass_SetData((HyperTextClass *) obj, &e->u.set_data, caller_gid);
- else if(obj->inst.rtti == RTTI_SliderClass)
- SliderClass_SetData((SliderClass *) obj, &e->u.set_data, caller_gid);
- else if(obj->inst.rtti == RTTI_TokenGroupClass)
- TokenGroupClass_SetData((TokenGroupClass *) obj, &e->u.set_data, caller_gid);
- else if(obj->inst.rtti == RTTI_ListGroupClass)
- ListGroupClass_SetData((ListGroupClass *) obj, &e->u.set_data, caller_gid);
else if(obj->inst.rtti == RTTI_StreamClass)
StreamClass_SetData((StreamClass *) obj, &e->u.set_data, caller_gid);
else
Modified: redbutton-browser/trunk/ListGroupClass.c
===================================================================
--- redbutton-browser/trunk/ListGroupClass.c 2007-03-28 14:16:19 UTC (rev 261)
+++ redbutton-browser/trunk/ListGroupClass.c 2007-03-28 14:30:28 UTC (rev 262)
@@ -86,16 +86,6 @@
}
void
-ListGroupClass_SetData(ListGroupClass *t, SetData *set, OctetString *caller_gid)
-{
- verbose("ListGroupClass: %s; SetData", ExternalReference_name(&t->rootClass.inst.ref));
-
-/* TODO */
-printf("TODO: ListGroupClass_SetData not yet implemented\n");
- return;
-}
-
-void
ListGroupClass_Clone(ListGroupClass *t, Clone *params, OctetString *caller_gid)
{
verbose("ListGroupClass: %s; Clone", ExternalReference_name(&t->rootClass.inst.ref));
Modified: redbutton-browser/trunk/ListGroupClass.h
===================================================================
--- redbutton-browser/trunk/ListGroupClass.h 2007-03-28 14:16:19 UTC (rev 261)
+++ redbutton-browser/trunk/ListGroupClass.h 2007-03-28 14:30:28 UTC (rev 262)
@@ -12,7 +12,6 @@
void ListGroupClass_Deactivation(ListGroupClass *);
void ListGroupClass_Destruction(ListGroupClass *);
-void ListGroupClass_SetData(ListGroupClass *, SetData *, OctetString *);
void ListGroupClass_Clone(ListGroupClass *, Clone *, OctetString *);
void ListGroupClass_Move(ListGroupClass *, Move *, OctetString *);
void ListGroupClass_MoveTo(ListGroupClass *, MoveTo *, OctetString *);
Modified: redbutton-browser/trunk/RectangleClass.c
===================================================================
--- redbutton-browser/trunk/RectangleClass.c 2007-03-28 14:16:19 UTC (rev 261)
+++ redbutton-browser/trunk/RectangleClass.c 2007-03-28 14:30:28 UTC (rev 262)
@@ -102,16 +102,6 @@
}
void
-RectangleClass_SetData(RectangleClass *t, SetData *set, OctetString *caller_gid)
-{
- verbose("RectangleClass: %s; SetData", ExternalReference_name(&t->rootClass.inst.ref));
-
-/* TODO */
-printf("TODO: RectangleClass_SetData not yet implemented\n");
- return;
-}
-
-void
RectangleClass_Clone(RectangleClass *t, Clone *params, OctetString *caller_gid)
{
verbose("RectangleClass: %s; Clone", ExternalReference_name(&t->rootClass.inst.ref));
Modified: redbutton-browser/trunk/RectangleClass.h
===================================================================
--- redbutton-browser/trunk/RectangleClass.h 2007-03-28 14:16:19 UTC (rev 261)
+++ redbutton-browser/trunk/RectangleClass.h 2007-03-28 14:30:28 UTC (rev 262)
@@ -12,7 +12,6 @@
void RectangleClass_Deactivation(RectangleClass *);
void RectangleClass_Destruction(RectangleClass *);
-void RectangleClass_SetData(RectangleClass *, SetData *, OctetString *);
void RectangleClass_Clone(RectangleClass *, Clone *, OctetString *);
void RectangleClass_SetPosition(RectangleClass *, SetPosition *, OctetString *);
void RectangleClass_GetPosition(RectangleClass *, GetPosition *, OctetString *);
Modified: redbutton-browser/trunk/SliderClass.c
===================================================================
--- redbutton-browser/trunk/SliderClass.c 2007-03-28 14:16:19 UTC (rev 261)
+++ redbutton-browser/trunk/SliderClass.c 2007-03-28 14:30:28 UTC (rev 262)
@@ -122,16 +122,6 @@
}
void
-SliderClass_SetData(SliderClass *t, SetData *set, OctetString *caller_gid)
-{
- verbose("SliderClass: %s; SetData", ExternalReference_name(&t->rootClass.inst.ref));
-
-/* TODO */
-printf("TODO: SliderClass_SetData not yet implemented\n");
- return;
-}
-
-void
SliderClass_Clone(SliderClass *t, Clone *params, OctetString *caller_gid)
{
verbose("SliderClass: %s; Clone", ExternalReference_name(&t->rootClass.inst.ref));
Modified: redbutton-browser/trunk/SliderClass.h
===================================================================
--- redbutton-browser/trunk/SliderClass.h 2007-03-28 14:16:19 UTC (rev 261)
+++ redbutton-browser/trunk/SliderClass.h 2007-03-28 14:30:28 UTC (rev 262)
@@ -12,7 +12,6 @@
void SliderClass_Deactivation(SliderClass *);
void SliderClass_Destruction(SliderClass *);
-void SliderClass_SetData(SliderClass *, SetData *, OctetString *);
void SliderClass_Clone(SliderClass *, Clone *, OctetString *);
void SliderClass_SetPosition(SliderClass *, SetPosition *, OctetString *);
void SliderClass_GetPosition(SliderClass *, GetPosition *, OctetString *);
Modified: redbutton-browser/trunk/TokenGroupClass.c
===================================================================
--- redbutton-browser/trunk/TokenGroupClass.c 2007-03-28 14:16:19 UTC (rev 261)
+++ redbutton-browser/trunk/TokenGroupClass.c 2007-03-28 14:30:28 UTC (rev 262)
@@ -138,16 +138,6 @@
}
void
-TokenGroupClass_SetData(TokenGroupClass *t, SetData *set, OctetString *caller_gid)
-{
- verbose("TokenGroupClass: %s; SetData", ExternalReference_name(&t->rootClass.inst.ref));
-
-/* TODO */
-printf("TODO: TokenGroupClass_SetData not yet implemented\n");
- return;
-}
-
-void
TokenGroupClass_Clone(TokenGroupClass *t, Clone *params, OctetString *caller_gid)
{
verbose("TokenGroupClass: %s; Clone", ExternalReference_name(&t->rootClass.inst.ref));
Modified: redbutton-browser/trunk/TokenGroupClass.h
===================================================================
--- redbutton-browser/trunk/TokenGroupClass.h 2007-03-28 14:16:19 UTC (rev 261)
+++ redbutton-browser/trunk/TokenGroupClass.h 2007-03-28 14:30:28 UTC (rev 262)
@@ -13,7 +13,6 @@
void TokenGroupClass_Destruction(TokenGroupClass *);
void TokenGroupClass_TransferToken(TokenGroupClass *, unsigned int);
-void TokenGroupClass_SetData(TokenGroupClass *, SetData *, OctetString *);
void TokenGroupClass_Clone(TokenGroupClass *, Clone *, OctetString *);
void TokenGroupClass_Move(TokenGroupClass *, Move *, OctetString *);
void TokenGroupClass_MoveTo(TokenGroupClass *, MoveTo *, OctetString *);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-28 14:58:35
|
Revision: 263
http://svn.sourceforge.net/redbutton/?rev=263&view=rev
Author: skilvington
Date: 2007-03-28 07:58:34 -0700 (Wed, 28 Mar 2007)
Log Message:
-----------
VideoClass has no OriginalPaletteRef attribute
Modified Paths:
--------------
redbutton-browser/trunk/ElementaryAction.c
redbutton-browser/trunk/VideoClass.c
redbutton-browser/trunk/VideoClass.h
Modified: redbutton-browser/trunk/ElementaryAction.c
===================================================================
--- redbutton-browser/trunk/ElementaryAction.c 2007-03-28 14:30:28 UTC (rev 262)
+++ redbutton-browser/trunk/ElementaryAction.c 2007-03-28 14:58:34 UTC (rev 263)
@@ -1367,8 +1367,6 @@
SliderClass_SetPaletteRef((SliderClass *) obj, &e->u.set_palette_ref, caller_gid);
else if(obj->inst.rtti == RTTI_TextClass)
TextClass_SetPaletteRef((TextClass *) obj, &e->u.set_palette_ref, caller_gid);
- else if(obj->inst.rtti == RTTI_VideoClass)
- VideoClass_SetPaletteRef((VideoClass *) obj, &e->u.set_palette_ref, caller_gid);
else
error("SetPaletteRef: unexpected target: %s", ExternalReference_name(&obj->inst.ref));
}
Modified: redbutton-browser/trunk/VideoClass.c
===================================================================
--- redbutton-browser/trunk/VideoClass.c 2007-03-28 14:30:28 UTC (rev 262)
+++ redbutton-browser/trunk/VideoClass.c 2007-03-28 14:58:34 UTC (rev 263)
@@ -352,16 +352,6 @@
}
void
-VideoClass_SetPaletteRef(VideoClass *t, SetPaletteRef *params, OctetString *caller_gid)
-{
- verbose("VideoClass: %s; SetPaletteRef", ExternalReference_name(&t->rootClass.inst.ref));
-
-/* TODO */
-printf("TODO: VideoClass_SetPaletteRef not yet implemented\n");
- return;
-}
-
-void
VideoClass_SetVideoDecodeOffset(VideoClass *t, SetVideoDecodeOffset *params, OctetString *caller_gid)
{
verbose("VideoClass: %s; SetVideoDecodeOffset", ExternalReference_name(&t->rootClass.inst.ref));
Modified: redbutton-browser/trunk/VideoClass.h
===================================================================
--- redbutton-browser/trunk/VideoClass.h 2007-03-28 14:30:28 UTC (rev 262)
+++ redbutton-browser/trunk/VideoClass.h 2007-03-28 14:58:34 UTC (rev 263)
@@ -20,7 +20,6 @@
void VideoClass_SendToBack(VideoClass *);
void VideoClass_PutBefore(VideoClass *, PutBefore *, OctetString *);
void VideoClass_PutBehind(VideoClass *, PutBehind *, OctetString *);
-void VideoClass_SetPaletteRef(VideoClass *, SetPaletteRef *, OctetString *);
void VideoClass_SetVideoDecodeOffset(VideoClass *, SetVideoDecodeOffset *, OctetString *);
void VideoClass_GetVideoDecodeOffset(VideoClass *, GetVideoDecodeOffset *, OctetString *);
void VideoClass_ScaleVideo(VideoClass *, ScaleVideo *, OctetString *);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-28 15:07:02
|
Revision: 264
http://svn.sourceforge.net/redbutton/?rev=264&view=rev
Author: skilvington
Date: 2007-03-28 08:07:00 -0700 (Wed, 28 Mar 2007)
Log Message:
-----------
UK MHEG Profile says we don't support PaletteClass
Modified Paths:
--------------
redbutton-browser/trunk/BitmapClass.c
redbutton-browser/trunk/DynamicLineArtClass.c
redbutton-browser/trunk/EntryFieldClass.c
redbutton-browser/trunk/HyperTextClass.c
redbutton-browser/trunk/RectangleClass.c
redbutton-browser/trunk/SliderClass.c
redbutton-browser/trunk/TextClass.c
Modified: redbutton-browser/trunk/BitmapClass.c
===================================================================
--- redbutton-browser/trunk/BitmapClass.c 2007-03-28 14:58:34 UTC (rev 263)
+++ redbutton-browser/trunk/BitmapClass.c 2007-03-28 15:07:00 UTC (rev 264)
@@ -382,10 +382,9 @@
void
BitmapClass_SetPaletteRef(BitmapClass *t, SetPaletteRef *params, OctetString *caller_gid)
{
- verbose("BitmapClass: %s; SetPaletteRef", ExternalReference_name(&t->rootClass.inst.ref));
+ /* UK MHEG Profile says we don't support PaletteClass */
+ error("BitmapClass: %s; SetPaletteRef not supported", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: BitmapClass_SetPaletteRef not yet implemented\n");
return;
}
Modified: redbutton-browser/trunk/DynamicLineArtClass.c
===================================================================
--- redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-28 14:58:34 UTC (rev 263)
+++ redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-28 15:07:00 UTC (rev 264)
@@ -331,10 +331,9 @@
void
DynamicLineArtClass_SetPaletteRef(DynamicLineArtClass *t, SetPaletteRef *params, OctetString *caller_gid)
{
- verbose("DynamicLineArtClass: %s; SetPaletteRef", ExternalReference_name(&t->rootClass.inst.ref));
+ /* UK MHEG Profile says we don't support PaletteClass */
+ error("DynamicLineArtClass: %s; SetPaletteRef not supported", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: DynamicLineArtClass_SetPaletteRef not yet implemented\n");
return;
}
Modified: redbutton-browser/trunk/EntryFieldClass.c
===================================================================
--- redbutton-browser/trunk/EntryFieldClass.c 2007-03-28 14:58:34 UTC (rev 263)
+++ redbutton-browser/trunk/EntryFieldClass.c 2007-03-28 15:07:00 UTC (rev 264)
@@ -372,10 +372,9 @@
void
EntryFieldClass_SetPaletteRef(EntryFieldClass *t, SetPaletteRef *params, OctetString *caller_gid)
{
- verbose("EntryFieldClass: %s; SetPaletteRef", ExternalReference_name(&t->rootClass.inst.ref));
+ /* UK MHEG Profile says we don't support PaletteClass */
+ error("EntryFieldClass: %s; SetPaletteRef not supported", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: EntryFieldClass_SetPaletteRef not yet implemented\n");
return;
}
Modified: redbutton-browser/trunk/HyperTextClass.c
===================================================================
--- redbutton-browser/trunk/HyperTextClass.c 2007-03-28 14:58:34 UTC (rev 263)
+++ redbutton-browser/trunk/HyperTextClass.c 2007-03-28 15:07:00 UTC (rev 264)
@@ -376,10 +376,9 @@
void
HyperTextClass_SetPaletteRef(HyperTextClass *t, SetPaletteRef *params, OctetString *caller_gid)
{
- verbose("HyperTextClass: %s; SetPaletteRef", ExternalReference_name(&t->rootClass.inst.ref));
+ /* UK MHEG Profile says we don't support PaletteClass */
+ error("HyperTextClass: %s; SetPaletteRef not supported", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: HyperTextClass_SetPaletteRef not yet implemented\n");
return;
}
Modified: redbutton-browser/trunk/RectangleClass.c
===================================================================
--- redbutton-browser/trunk/RectangleClass.c 2007-03-28 14:58:34 UTC (rev 263)
+++ redbutton-browser/trunk/RectangleClass.c 2007-03-28 15:07:00 UTC (rev 264)
@@ -300,10 +300,9 @@
void
RectangleClass_SetPaletteRef(RectangleClass *t, SetPaletteRef *params, OctetString *caller_gid)
{
- verbose("RectangleClass: %s; SetPaletteRef", ExternalReference_name(&t->rootClass.inst.ref));
+ /* UK MHEG Profile says we don't support PaletteClass */
+ error("RectangleClass: %s; SetPaletteRef not supported", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: RectangleClass_SetPaletteRef not yet implemented\n");
return;
}
Modified: redbutton-browser/trunk/SliderClass.c
===================================================================
--- redbutton-browser/trunk/SliderClass.c 2007-03-28 14:58:34 UTC (rev 263)
+++ redbutton-browser/trunk/SliderClass.c 2007-03-28 15:07:00 UTC (rev 264)
@@ -255,10 +255,9 @@
void
SliderClass_SetPaletteRef(SliderClass *t, SetPaletteRef *params, OctetString *caller_gid)
{
- verbose("SliderClass: %s; SetPaletteRef", ExternalReference_name(&t->rootClass.inst.ref));
+ /* UK MHEG Profile says we don't support PaletteClass */
+ error("SliderClass: %s; SetPaletteRef not supported", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: SliderClass_SetPaletteRef not yet implemented\n");
return;
}
Modified: redbutton-browser/trunk/TextClass.c
===================================================================
--- redbutton-browser/trunk/TextClass.c 2007-03-28 14:58:34 UTC (rev 263)
+++ redbutton-browser/trunk/TextClass.c 2007-03-28 15:07:00 UTC (rev 264)
@@ -451,10 +451,9 @@
void
TextClass_SetPaletteRef(TextClass *t, SetPaletteRef *params, OctetString *caller_gid)
{
- verbose("TextClass: %s; SetPaletteRef", ExternalReference_name(&t->rootClass.inst.ref));
+ /* UK MHEG Profile says we don't support PaletteClass */
+ error("TextClass: %s; SetPaletteRef not supported", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: TextClass_SetPaletteRef not yet implemented\n");
return;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-03-28 15:59:11
|
Revision: 266
http://svn.sourceforge.net/redbutton/?rev=266&view=rev
Author: skilvington
Date: 2007-03-28 08:59:10 -0700 (Wed, 28 Mar 2007)
Log Message:
-----------
rb-download caches everything
Modified Paths:
--------------
redbutton-browser/trunk/ApplicationClass.c
redbutton-browser/trunk/BitmapClass.c
redbutton-browser/trunk/DynamicLineArtClass.c
redbutton-browser/trunk/EntryFieldClass.c
redbutton-browser/trunk/HyperTextClass.c
redbutton-browser/trunk/RectangleClass.c
redbutton-browser/trunk/RootClass.c
redbutton-browser/trunk/SceneClass.c
redbutton-browser/trunk/SliderClass.c
redbutton-browser/trunk/StreamClass.c
redbutton-browser/trunk/TextClass.c
redbutton-browser/trunk/TokenGroupClass.c
redbutton-browser/trunk/VideoClass.c
Modified: redbutton-browser/trunk/ApplicationClass.c
===================================================================
--- redbutton-browser/trunk/ApplicationClass.c 2007-03-28 15:18:40 UTC (rev 265)
+++ redbutton-browser/trunk/ApplicationClass.c 2007-03-28 15:59:10 UTC (rev 266)
@@ -219,7 +219,11 @@
ApplicationClass_Deactivation(a);
}
-/*TODO caching */
+ /*
+ * spec says we should handle caching here
+ * rb-download caches everything
+ */
+
free_ApplicationClassInstanceVars(&a->inst);
/* generate an IsDeleted event */
@@ -232,10 +236,8 @@
void
ApplicationClass_SetCachePriority(ApplicationClass *t, SetCachePriority *params, OctetString *caller_gid)
{
- verbose("ApplicationClass: %s; SetCachePriority", ExternalReference_name(&t->rootClass.inst.ref));
+ verbose("ApplicationClass: %s; SetCachePriority (ignored)", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: ApplicationClass_SetCachePriority not yet implemented\n");
return;
}
Modified: redbutton-browser/trunk/BitmapClass.c
===================================================================
--- redbutton-browser/trunk/BitmapClass.c 2007-03-28 15:18:40 UTC (rev 265)
+++ redbutton-browser/trunk/BitmapClass.c 2007-03-28 15:59:10 UTC (rev 266)
@@ -145,7 +145,11 @@
BitmapClass_Deactivation(t);
}
-/* TODO caching */
+ /*
+ * spec says we should handle caching here
+ * rb-download caches everything
+ */
+
free_BitmapClassInstanceVars(&t->inst);
/* generate an IsDeleted event */
Modified: redbutton-browser/trunk/DynamicLineArtClass.c
===================================================================
--- redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-28 15:18:40 UTC (rev 265)
+++ redbutton-browser/trunk/DynamicLineArtClass.c 2007-03-28 15:59:10 UTC (rev 266)
@@ -101,7 +101,11 @@
DynamicLineArtClass_Deactivation(t);
}
-/* TODO caching */
+ /*
+ * spec says we should handle caching here
+ * rb-download caches everything
+ */
+
free_LineArtClassInstanceVars(&t->inst);
/* generate an IsDeleted event */
Modified: redbutton-browser/trunk/EntryFieldClass.c
===================================================================
--- redbutton-browser/trunk/EntryFieldClass.c 2007-03-28 15:18:40 UTC (rev 265)
+++ redbutton-browser/trunk/EntryFieldClass.c 2007-03-28 15:59:10 UTC (rev 266)
@@ -218,7 +218,11 @@
EntryFieldClass_Deactivation(t);
}
-/* TODO caching */
+ /*
+ * spec says we should handle caching here
+ * rb-download caches everything
+ */
+
free_EntryFieldClassInstanceVars(&t->inst);
/* generate an IsDeleted event */
Modified: redbutton-browser/trunk/HyperTextClass.c
===================================================================
--- redbutton-browser/trunk/HyperTextClass.c 2007-03-28 15:18:40 UTC (rev 265)
+++ redbutton-browser/trunk/HyperTextClass.c 2007-03-28 15:59:10 UTC (rev 266)
@@ -222,7 +222,11 @@
HyperTextClass_Deactivation(t);
}
-/* TODO caching */
+ /*
+ * spec says we should handle caching here
+ * rb-download caches everything
+ */
+
free_HyperTextClassInstanceVars(&t->inst);
/* generate an IsDeleted event */
Modified: redbutton-browser/trunk/RectangleClass.c
===================================================================
--- redbutton-browser/trunk/RectangleClass.c 2007-03-28 15:18:40 UTC (rev 265)
+++ redbutton-browser/trunk/RectangleClass.c 2007-03-28 15:59:10 UTC (rev 266)
@@ -91,7 +91,11 @@
RectangleClass_Deactivation(t);
}
-/* TODO caching */
+ /*
+ * spec says we should handle caching here
+ * rb-download caches everything
+ */
+
free_LineArtClassInstanceVars(&t->inst);
/* generate an IsDeleted event */
Modified: redbutton-browser/trunk/RootClass.c
===================================================================
--- redbutton-browser/trunk/RootClass.c 2007-03-28 15:18:40 UTC (rev 265)
+++ redbutton-browser/trunk/RootClass.c 2007-03-28 15:59:10 UTC (rev 266)
@@ -223,7 +223,10 @@
RootClass_Deactivation(r);
}
-/* TODO caching */
+ /*
+ * spec says we should handle caching here
+ * rb-download caches everything
+ */
/* generate an IsDeleted event */
r->inst.AvailabilityStatus = false;
Modified: redbutton-browser/trunk/SceneClass.c
===================================================================
--- redbutton-browser/trunk/SceneClass.c 2007-03-28 15:18:40 UTC (rev 265)
+++ redbutton-browser/trunk/SceneClass.c 2007-03-28 15:59:10 UTC (rev 266)
@@ -186,7 +186,11 @@
SceneClass_Deactivation(s);
}
-/* TODO caching */
+ /*
+ * spec says we should handle caching here
+ * rb-download caches everything
+ */
+
free_SceneClassInstanceVars(&s->inst);
/* generate an IsDeleted event */
@@ -199,10 +203,8 @@
void
SceneClass_SetCachePriority(SceneClass *t, SetCachePriority *params, OctetString *caller_gid)
{
- verbose("SceneClass: %s; SetCachePriority", ExternalReference_name(&t->rootClass.inst.ref));
+ verbose("SceneClass: %s; SetCachePriority (ignored)", ExternalReference_name(&t->rootClass.inst.ref));
-/* TODO */
-printf("TODO: SceneClass_SetCachePriority not yet implemented\n");
return;
}
Modified: redbutton-browser/trunk/SliderClass.c
===================================================================
--- redbutton-browser/trunk/SliderClass.c 2007-03-28 15:18:40 UTC (rev 265)
+++ redbutton-browser/trunk/SliderClass.c 2007-03-28 15:59:10 UTC (rev 266)
@@ -111,7 +111,11 @@
SliderClass_Deactivation(t);
}
-/* TODO caching */
+ /*
+ * spec says we should handle caching here
+ * rb-download caches everything
+ */
+
free_SliderClassInstanceVars(&t->inst);
/* generate an IsDeleted event */
Modified: redbutton-browser/trunk/StreamClass.c
===================================================================
--- redbutton-browser/trunk/StreamClass.c 2007-03-28 15:18:40 UTC (rev 265)
+++ redbutton-browser/trunk/StreamClass.c 2007-03-28 15:59:10 UTC (rev 266)
@@ -233,7 +233,12 @@
}
/* RootClass Destruction */
-/* TODO caching */
+
+ /*
+ * spec says we should handle caching here
+ * rb-download caches everything
+ */
+
free_StreamClassInstanceVars(&t->inst);
/* generate an IsDeleted event */
Modified: redbutton-browser/trunk/TextClass.c
===================================================================
--- redbutton-browser/trunk/TextClass.c 2007-03-28 15:18:40 UTC (rev 265)
+++ redbutton-browser/trunk/TextClass.c 2007-03-28 15:59:10 UTC (rev 266)
@@ -214,7 +214,11 @@
TextClass_Deactivation(t);
}
-/* TODO caching */
+ /*
+ * spec says we should handle caching here
+ * rb-download caches everything
+ */
+
free_TextClassInstanceVars(&t->inst);
/* generate an IsDeleted event */
Modified: redbutton-browser/trunk/TokenGroupClass.c
===================================================================
--- redbutton-browser/trunk/TokenGroupClass.c 2007-03-28 15:18:40 UTC (rev 265)
+++ redbutton-browser/trunk/TokenGroupClass.c 2007-03-28 15:59:10 UTC (rev 266)
@@ -114,7 +114,11 @@
if(!RootClass_Destruction(&t->rootClass))
return;
-/* TODO caching */
+ /*
+ * spec says we should handle caching here
+ * rb-download caches everything
+ */
+
free_TokenGroupClassInstanceVars(&t->inst);
return;
Modified: redbutton-browser/trunk/VideoClass.c
===================================================================
--- redbutton-browser/trunk/VideoClass.c 2007-03-28 15:18:40 UTC (rev 265)
+++ redbutton-browser/trunk/VideoClass.c 2007-03-28 15:59:10 UTC (rev 266)
@@ -151,7 +151,11 @@
VideoClass_Deactivation(t);
}
-/* TODO caching */
+ /*
+ * spec says we should handle caching here
+ * rb-download caches everything
+ */
+
free_VideoClassInstanceVars(&t->inst);
/* generate an IsDeleted event */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-04-01 09:31:53
|
Revision: 267
http://svn.sourceforge.net/redbutton/?rev=267&view=rev
Author: skilvington
Date: 2007-04-01 02:31:49 -0700 (Sun, 01 Apr 2007)
Log Message:
-----------
clear the screen on boot/launch/retune/etc
Modified Paths:
--------------
redbutton-browser/trunk/MHEGDisplay.c
redbutton-browser/trunk/MHEGDisplay.h
redbutton-browser/trunk/MHEGEngine.c
Modified: redbutton-browser/trunk/MHEGDisplay.c
===================================================================
--- redbutton-browser/trunk/MHEGDisplay.c 2007-03-28 15:59:10 UTC (rev 266)
+++ redbutton-browser/trunk/MHEGDisplay.c 2007-04-01 09:31:49 UTC (rev 267)
@@ -384,6 +384,30 @@
return;
}
+void
+MHEGDisplay_clearScreen(MHEGDisplay *d)
+{
+ XYPosition pos = {0, 0};
+ OriginalBoxSize box = {d->xres, d->yres};
+ MHEGColour black;
+
+ box.x_length = d->xres;
+ box.y_length = d->yres;
+
+ MHEGColour_black(&black);
+ MHEGDisplay_fillRectangle(d, &pos, &box, &black);
+
+ /* use the new object we have just drawn */
+ MHEGDisplay_useOverlay(d);
+
+ /* refresh the screen */
+ MHEGDisplay_refresh(d, &pos, &box);
+
+ XFlush(d->dpy);
+
+ return;
+}
+
/*
* all these drawing routines draw onto next_overlay_pic
* all coords should be in the range 0-MHEG_XRES, 0-MHEG_YRES
Modified: redbutton-browser/trunk/MHEGDisplay.h
===================================================================
--- redbutton-browser/trunk/MHEGDisplay.h 2007-03-28 15:59:10 UTC (rev 266)
+++ redbutton-browser/trunk/MHEGDisplay.h 2007-04-01 09:31:49 UTC (rev 267)
@@ -63,6 +63,8 @@
void MHEGDisplay_refresh(MHEGDisplay *, XYPosition *, OriginalBoxSize *);
+void MHEGDisplay_clearScreen(MHEGDisplay *);
+
/* drawing routines */
void MHEGDisplay_setClipRectangle(MHEGDisplay *, XYPosition *, OriginalBoxSize *);
void MHEGDisplay_unsetClipRectangle(MHEGDisplay *);
Modified: redbutton-browser/trunk/MHEGEngine.c
===================================================================
--- redbutton-browser/trunk/MHEGEngine.c 2007-03-28 15:59:10 UTC (rev 266)
+++ redbutton-browser/trunk/MHEGEngine.c 2007-04-01 09:31:49 UTC (rev 267)
@@ -199,6 +199,8 @@
do
{
+ /* clear the display (if you want a splash screen, do it here) */
+ MHEGDisplay_clearScreen(&engine.display);
/* search for the boot object for timeout seconds */
found = false;
gettimeofday(&start, NULL);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ski...@us...> - 2007-04-03 11:18:13
|
Revision: 273
http://svn.sourceforge.net/redbutton/?rev=273&view=rev
Author: skilvington
Date: 2007-04-03 04:18:09 -0700 (Tue, 03 Apr 2007)
Log Message:
-----------
add EPG key for NZ MHEG profile
Modified Paths:
--------------
redbutton-browser/trunk/MHEGDisplay.c
redbutton-browser/trunk/MHEGEngine.c
redbutton-browser/trunk/MHEGEngine.h
redbutton-browser/trunk/keymap.conf.example
redbutton-browser/trunk/rb-keymap.c
Modified: redbutton-browser/trunk/MHEGDisplay.c
===================================================================
--- redbutton-browser/trunk/MHEGDisplay.c 2007-04-02 08:30:24 UTC (rev 272)
+++ redbutton-browser/trunk/MHEGDisplay.c 2007-04-03 11:18:09 UTC (rev 273)
@@ -60,6 +60,7 @@
{ XK_y, MHEGKey_Yellow },
{ XK_b, MHEGKey_Blue },
{ XK_t, MHEGKey_Text },
+ { XK_e, MHEGKey_EPG },
{ 0, 0 } /* terminator */
};
Modified: redbutton-browser/trunk/MHEGEngine.c
===================================================================
--- redbutton-browser/trunk/MHEGEngine.c 2007-04-02 08:30:24 UTC (rev 272)
+++ redbutton-browser/trunk/MHEGEngine.c 2007-04-03 11:18:09 UTC (rev 273)
@@ -818,6 +818,11 @@
data.u.integer = EngineEvent_TextKeyFunction;
MHEGEngine_generateAsyncEvent(&app->rootClass.inst.ref, EventType_engine_event, &data);
}
+ else if(key == MHEGKey_EPG)
+ {
+ data.u.integer = EngineEvent_EPGKeyFunction;
+ MHEGEngine_generateAsyncEvent(&app->rootClass.inst.ref, EventType_engine_event, &data);
+ }
else if(key == MHEGKey_Cancel)
{
data.u.integer = EngineEvent_CancelKeyFunction;
Modified: redbutton-browser/trunk/MHEGEngine.h
===================================================================
--- redbutton-browser/trunk/MHEGEngine.h 2007-04-02 08:30:24 UTC (rev 272)
+++ redbutton-browser/trunk/MHEGEngine.h 2007-04-03 11:18:09 UTC (rev 273)
@@ -45,6 +45,8 @@
#define EngineEvent_GreenKeyFunction 101
#define EngineEvent_YellowKeyFunction 102
#define EngineEvent_BlueKeyFunction 103
+/* from the NZ profile */
+#define EngineEvent_EPGKeyFunction 300
/* all other values are reserved */
/* EventTag key numbers for UserInput events */
@@ -69,6 +71,7 @@
#define MHEGKey_Yellow 102
#define MHEGKey_Blue 103
#define MHEGKey_Text 104
+#define MHEGKey_EPG 300
/* ContentHook values */
#define ContentHook_Bitmap_MPEG 2
Modified: redbutton-browser/trunk/keymap.conf.example
===================================================================
--- redbutton-browser/trunk/keymap.conf.example 2007-04-02 08:30:24 UTC (rev 272)
+++ redbutton-browser/trunk/keymap.conf.example 2007-04-03 11:18:09 UTC (rev 273)
@@ -19,3 +19,4 @@
F3
F4
i
+e
Modified: redbutton-browser/trunk/rb-keymap.c
===================================================================
--- redbutton-browser/trunk/rb-keymap.c 2007-04-02 08:30:24 UTC (rev 272)
+++ redbutton-browser/trunk/rb-keymap.c 2007-04-03 11:18:09 UTC (rev 273)
@@ -47,6 +47,7 @@
"Yellow",
"Blue",
"Text",
+ "EPG",
NULL
};
int i;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|