redbutton-devel Mailing List for RedButton MHEG Engine (Page 25)
Brought to you by:
skilvington
You can subscribe to this list here.
| 2006 |
Jan
(1) |
Feb
(4) |
Mar
(27) |
Apr
(6) |
May
(46) |
Jun
(45) |
Jul
(7) |
Aug
(4) |
Sep
(7) |
Oct
(5) |
Nov
(10) |
Dec
(11) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2007 |
Jan
(49) |
Feb
(29) |
Mar
(35) |
Apr
(43) |
May
(23) |
Jun
(4) |
Jul
(1) |
Aug
(58) |
Sep
(66) |
Oct
(27) |
Nov
(15) |
Dec
(1) |
| 2008 |
Jan
(11) |
Feb
|
Mar
(8) |
Apr
|
May
|
Jun
(30) |
Jul
(1) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
(3) |
Dec
(6) |
| 2009 |
Jan
(6) |
Feb
(1) |
Mar
(2) |
Apr
(5) |
May
(2) |
Jun
(1) |
Jul
(7) |
Aug
|
Sep
(2) |
Oct
(2) |
Nov
|
Dec
(6) |
| 2010 |
Jan
(6) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(6) |
Sep
(4) |
Oct
|
Nov
(11) |
Dec
(4) |
| 2011 |
Jan
|
Feb
(11) |
Mar
(8) |
Apr
|
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
(4) |
Oct
|
Nov
(2) |
Dec
|
| 2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <ski...@us...> - 2006-05-31 13:27:33
|
Revision: 82 Author: skilvington Date: 2006-05-31 06:27:14 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=82&view=rev Log Message: ----------- typo Modified Paths: -------------- www/index.html Modified: www/index.html =================================================================== --- www/index.html 2006-05-31 08:38:47 UTC (rev 81) +++ www/index.html 2006-05-31 13:27:14 UTC (rev 82) @@ -148,7 +148,7 @@ The SVN version now does video (still no audio yet). Note that it does not currently use any acceleration that your graphics card may provide so it'll drop frames in full screen mode unless you have a very fast processor -(or your full screen X resolution set to 720x576 pixels). +(or your full screen X resolution is set to 720x576 pixels). <P> It will only display apps that conform to the UK MHEG Profile (available from <A href="http://www.dtg.org.uk/">www.dtg.org.uk</A>). This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-31 08:39:05
|
Revision: 81 Author: skilvington Date: 2006-05-31 01:38:47 -0700 (Wed, 31 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=81&view=rev Log Message: ----------- say svn code does video on the web page Modified Paths: -------------- www/index.html Modified: www/index.html =================================================================== --- www/index.html 2006-05-23 08:47:12 UTC (rev 80) +++ www/index.html 2006-05-31 08:38:47 UTC (rev 81) @@ -145,6 +145,11 @@ However, it is enough to be usable. The main things missing are video and audio streams, at the moment it'll just draw a green box where any video should be. <P> +The SVN version now does video (still no audio yet). +Note that it does not currently use any acceleration that your graphics card may provide +so it'll drop frames in full screen mode unless you have a very fast processor +(or your full screen X resolution set to 720x576 pixels). +<P> It will only display apps that conform to the UK MHEG Profile (available from <A href="http://www.dtg.org.uk/">www.dtg.org.uk</A>). <P> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-23 08:47:16
|
Revision: 80 Author: skilvington Date: 2006-05-23 01:47:12 -0700 (Tue, 23 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=80&view=rev Log Message: ----------- Random(0) returns 1 Modified Paths: -------------- redbutton-browser/trunk/ResidentProgramClass.c Modified: redbutton-browser/trunk/ResidentProgramClass.c =================================================================== --- redbutton-browser/trunk/ResidentProgramClass.c 2006-05-23 08:45:14 UTC (rev 79) +++ redbutton-browser/trunk/ResidentProgramClass.c 2006-05-23 08:47:12 UTC (rev 80) @@ -633,9 +633,9 @@ num = GenericInteger_getInteger(num_par, caller_gid); - /* ITV like to get Random(0) */ + /* ITV like to get Random(0), returned value is supposed to be in the range 1..num */ if(num == 0) - rnd = 0; + rnd = 1; else /* man page says low order bits are random too */ rnd = 1 + (random() % num); GenericInteger_setInteger(random_par, caller_gid, rnd); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-23 08:45:19
|
Revision: 79 Author: skilvington Date: 2006-05-23 01:45:14 -0700 (Tue, 23 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=79&view=rev Log Message: ----------- stop Random(0) causing a floating point error Modified Paths: -------------- redbutton-browser/trunk/ResidentProgramClass.c Modified: redbutton-browser/trunk/ResidentProgramClass.c =================================================================== --- redbutton-browser/trunk/ResidentProgramClass.c 2006-05-22 22:01:19 UTC (rev 78) +++ redbutton-browser/trunk/ResidentProgramClass.c 2006-05-23 08:45:14 UTC (rev 79) @@ -633,8 +633,11 @@ num = GenericInteger_getInteger(num_par, caller_gid); - /* man page says low order bits are random */ - rnd = 1 + (random() % num); + /* ITV like to get Random(0) */ + if(num == 0) + rnd = 0; + else /* man page says low order bits are random too */ + rnd = 1 + (random() % num); GenericInteger_setInteger(random_par, caller_gid, rnd); verbose("ResidentProgram: Random(%u, %u)", num, rnd); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-22 22:01:23
|
Revision: 78 Author: skilvington Date: 2006-05-22 15:01:19 -0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=78&view=rev Log Message: ----------- typo Modified Paths: -------------- redbutton-browser/trunk/MHEGVideoOutput.c Modified: redbutton-browser/trunk/MHEGVideoOutput.c =================================================================== --- redbutton-browser/trunk/MHEGVideoOutput.c 2006-05-22 16:24:08 UTC (rev 77) +++ redbutton-browser/trunk/MHEGVideoOutput.c 2006-05-22 22:01:19 UTC (rev 78) @@ -1,5 +1,5 @@ /* - * MHEGVideoOutput.h + * MHEGVideoOutput.c */ #include <sys/ipc.h> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-22 16:24:15
|
Revision: 77 Author: skilvington Date: 2006-05-22 09:24:08 -0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=77&view=rev Log Message: ----------- implement ScaleVideo Modified Paths: -------------- redbutton-browser/trunk/MHEGStreamPlayer.c redbutton-browser/trunk/VideoClass.c redbutton-browser/trunk/add_instance_vars.conf Modified: redbutton-browser/trunk/MHEGStreamPlayer.c =================================================================== --- redbutton-browser/trunk/MHEGStreamPlayer.c 2006-05-22 16:03:57 UTC (rev 76) +++ redbutton-browser/trunk/MHEGStreamPlayer.c 2006-05-22 16:24:08 UTC (rev 77) @@ -400,11 +400,19 @@ if(!drop_frame) { /* scale the next frame if necessary */ - out_width = vf->width; - out_height = vf->height; -/* TODO */ -/* use scaled values if ScaleVideo has been called */ -/* have a lock incase we are doing ScaleVideo in another thread */ + pthread_mutex_lock(&p->video->inst.scaled_lock); + /* use scaled values if ScaleVideo has been called */ + if(p->video->inst.scaled) + { + out_width = p->video->inst.scaled_width; + out_height = p->video->inst.scaled_height; + } + else + { + out_width = vf->width; + out_height = vf->height; + } + pthread_mutex_unlock(&p->video->inst.scaled_lock); /* scale up if fullscreen */ if(d->fullscreen) { @@ -435,9 +443,10 @@ //now=av_gettime(); //printf("display frame %d: pts=%f this_time=%lld real_time=%lld (diff=%lld)\n", nframes, vf->pts, last_time, now, now-last_time); /* origin of VideoClass */ -/* TODO should probably have a lock for this in case we are doing SetPosition in another thread */ + pthread_mutex_lock(&p->video->inst.bbox_lock); out_x = p->video->inst.Position.x_position; out_y = p->video->inst.Position.y_position; + pthread_mutex_unlock(&p->video->inst.bbox_lock); /* scale if fullscreen */ if(d->fullscreen) { @@ -447,7 +456,9 @@ /* draw the current frame */ MHEGVideoOutput_drawFrame(&vo, out_x, out_y); /* redraw objects above the video */ + pthread_mutex_lock(&p->video->inst.bbox_lock); MHEGDisplay_refresh(d, &p->video->inst.Position, &p->video->inst.BoxSize); + pthread_mutex_unlock(&p->video->inst.bbox_lock); /* get it drawn straight away */ XFlush(d->dpy); } Modified: redbutton-browser/trunk/VideoClass.c =================================================================== --- redbutton-browser/trunk/VideoClass.c 2006-05-22 16:03:57 UTC (rev 76) +++ redbutton-browser/trunk/VideoClass.c 2006-05-22 16:24:08 UTC (rev 77) @@ -30,6 +30,10 @@ v->VideoDecodeOffset.x_position = 0; v->VideoDecodeOffset.y_position = 0; + pthread_mutex_init(&v->bbox_lock, NULL); + pthread_mutex_init(&v->scaled_lock, NULL); + v->scaled = false; + return; } @@ -39,6 +43,9 @@ if(v->have_PaletteRef) free_ObjectReference(&v->PaletteRef); + pthread_mutex_destroy(&v->bbox_lock); + pthread_mutex_destroy(&v->scaled_lock); + return; } @@ -137,8 +144,10 @@ old.x_position = t->inst.Position.x_position; old.y_position = t->inst.Position.y_position; + pthread_mutex_lock(&t->inst.bbox_lock); t->inst.Position.x_position = GenericInteger_getInteger(¶ms->new_x_position, caller_gid); t->inst.Position.y_position = GenericInteger_getInteger(¶ms->new_y_position, caller_gid); + pthread_mutex_unlock(&t->inst.bbox_lock); /* if it is active, redraw it */ if(t->rootClass.inst.RunningStatus) @@ -196,8 +205,10 @@ old.x_length = t->inst.BoxSize.x_length; old.y_length = t->inst.BoxSize.y_length; + pthread_mutex_lock(&t->inst.bbox_lock); 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); + pthread_mutex_unlock(&t->inst.bbox_lock); /* if it is active, redraw it */ if(t->rootClass.inst.RunningStatus) @@ -346,16 +357,14 @@ void VideoClass_ScaleVideo(VideoClass *t, ScaleVideo *params, OctetString *caller_gid) { - int x_scale; - int y_scale; - verbose("VideoClass: %s; ScaleVideo", ExternalReference_name(&t->rootClass.inst.ref)); - x_scale = GenericInteger_getInteger(¶ms->x_scale, caller_gid); - y_scale = GenericInteger_getInteger(¶ms->y_scale, caller_gid); + pthread_mutex_lock(&t->inst.scaled_lock); + t->inst.scaled = true; + t->inst.scaled_width = GenericInteger_getInteger(¶ms->x_scale, caller_gid); + t->inst.scaled_height = GenericInteger_getInteger(¶ms->y_scale, caller_gid); + pthread_mutex_unlock(&t->inst.scaled_lock); -/* TODO */ -printf("TODO: VideoClass_ScaleVideo(%d, %d) not yet implemented\n", x_scale, y_scale); return; } Modified: redbutton-browser/trunk/add_instance_vars.conf =================================================================== --- redbutton-browser/trunk/add_instance_vars.conf 2006-05-22 16:03:57 UTC (rev 76) +++ redbutton-browser/trunk/add_instance_vars.conf 2006-05-22 16:24:08 UTC (rev 77) @@ -165,6 +165,8 @@ </TextClass> <VideoClass> +#include <pthread.h> + typedef struct { /* inherited from VisibleClass */ @@ -175,6 +177,13 @@ /* VideoClass */ /* UK MHEG Profile adds this */ XYPosition VideoDecodeOffset; + /* we add a lock for the size/position */ + pthread_mutex_t bbox_lock; + /* and the scaled size */ + pthread_mutex_t scaled_lock; + bool scaled; + unsigned int scaled_width; + unsigned int scaled_height; } VideoClassInstanceVars; </VideoClass> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-22 16:04:05
|
Revision: 76 Author: skilvington Date: 2006-05-22 09:03:57 -0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=76&view=rev Log Message: ----------- allow video output resizing to change mid-stream Modified Paths: -------------- redbutton-browser/trunk/MHEGStreamPlayer.c redbutton-browser/trunk/MHEGVideoOutput.c redbutton-browser/trunk/MHEGVideoOutput.h Modified: redbutton-browser/trunk/MHEGStreamPlayer.c =================================================================== --- redbutton-browser/trunk/MHEGStreamPlayer.c 2006-05-22 13:57:21 UTC (rev 75) +++ redbutton-browser/trunk/MHEGStreamPlayer.c 2006-05-22 16:03:57 UTC (rev 76) @@ -404,6 +404,7 @@ out_height = vf->height; /* TODO */ /* use scaled values if ScaleVideo has been called */ +/* have a lock incase we are doing ScaleVideo in another thread */ /* scale up if fullscreen */ if(d->fullscreen) { @@ -432,7 +433,7 @@ /* remember the time stamp for this frame */ last_pts = vf->pts; //now=av_gettime(); -//printf("display frame %d: pts=%f this_time=%lld real_time=%lld (diff=%lld)\n", ++nframes, vf->pts, last_time, now, now-last_time); +//printf("display frame %d: pts=%f this_time=%lld real_time=%lld (diff=%lld)\n", nframes, vf->pts, last_time, now, now-last_time); /* origin of VideoClass */ /* TODO should probably have a lock for this in case we are doing SetPosition in another thread */ out_x = p->video->inst.Position.x_position; Modified: redbutton-browser/trunk/MHEGVideoOutput.c =================================================================== --- redbutton-browser/trunk/MHEGVideoOutput.c 2006-05-22 13:57:21 UTC (rev 75) +++ redbutton-browser/trunk/MHEGVideoOutput.c 2006-05-22 16:03:57 UTC (rev 76) @@ -2,7 +2,6 @@ * MHEGVideoOutput.h */ -#include <pthread.h> #include <sys/ipc.h> #include <sys/shm.h> #include <X11/Xlib.h> @@ -37,12 +36,20 @@ return x11_shm_fini(v); } +/* + * get ready to draw the given frame at the given output size + */ + void MHEGVideoOutput_prepareFrame(MHEGVideoOutput *v, VideoFrame *f, unsigned int out_width, unsigned int out_height) { return x11_shm_prepareFrame(v, f, out_width, out_height); } +/* + * draw the frame set up by MHEGVideoOutput_prepareFrame() at the given position on the contents Pixmap + */ + void MHEGVideoOutput_drawFrame(MHEGVideoOutput *v, int x, int y) { @@ -55,9 +62,8 @@ v->current_frame = NULL; v->resize_ctx = NULL; + v->resized_data = NULL; - v->tmpbuf_data = NULL; - return; } @@ -67,7 +73,7 @@ if(v->resize_ctx != NULL) { img_resample_close(v->resize_ctx); - safe_free(v->tmpbuf_data); + safe_free(v->resized_data); } if(v->current_frame != NULL) @@ -80,9 +86,9 @@ x11_shm_prepareFrame(MHEGVideoOutput *v, VideoFrame *f, unsigned int out_width, unsigned int out_height) { AVPicture *yuv_frame; - int tmpbuf_size; + int resized_size; - /* have we create the output frame yet */ + /* have we created the output frame yet */ if(v->current_frame == NULL) x11_shm_create_frame(v, out_width, out_height); @@ -93,17 +99,28 @@ /* see if the input size is different than the output size */ if(f->width != out_width || f->height != out_height) { -/* TODO */ -/* need to change resize_ctx if the input or output sizes have changed since last time */ -/* dont forget: img_resample_close(resize_ctx); */ -/* and to free or realloc tmpbuf_data */ - if(v->resize_ctx == NULL) + /* have the resize input or output dimensions changed */ + if(v->resize_ctx == NULL + || v->resize_in.width != f->width || v->resize_in.height != f->height + || v->resize_out.width != out_width || v->resize_out.height != out_height) { - v->resize_ctx = img_resample_init(out_width, out_height, f->width, f->height); - tmpbuf_size = avpicture_get_size(f->pix_fmt, out_width, out_height); - v->tmpbuf_data = safe_malloc(tmpbuf_size); - avpicture_fill(&v->resized_frame, v->tmpbuf_data, f->pix_fmt, out_width, out_height); + /* get rid of any existing resize context */ + if(v->resize_ctx != NULL) + img_resample_close(v->resize_ctx); + if((v->resize_ctx = img_resample_init(out_width, out_height, f->width, f->height)) == NULL) + fatal("Out of memory"); + /* remember the resize input and output dimensions */ + v->resize_in.width = f->width; + v->resize_in.height = f->height; + v->resize_out.width = out_width; + v->resize_out.height = out_height; + /* somewhere to store the resized frame */ + if((resized_size = avpicture_get_size(f->pix_fmt, out_width, out_height)) < 0) + fatal("x11_shm_prepareFrame: invalid frame size"); + v->resized_data = safe_realloc(v->resized_data, resized_size); + avpicture_fill(&v->resized_frame, v->resized_data, f->pix_fmt, out_width, out_height); } + /* resize it */ img_resample(v->resize_ctx, &v->resized_frame, &f->frame); yuv_frame = &v->resized_frame; } @@ -200,6 +217,7 @@ /* make sure no-one tries to use it */ v->current_frame = NULL; + /* get rid of the shared memory */ XShmDetach(d->dpy, &v->shm); shmdt(v->shm.shmaddr); shmctl(v->shm.shmid, IPC_RMID, NULL); Modified: redbutton-browser/trunk/MHEGVideoOutput.h =================================================================== --- redbutton-browser/trunk/MHEGVideoOutput.h 2006-05-22 13:57:21 UTC (rev 75) +++ redbutton-browser/trunk/MHEGVideoOutput.h 2006-05-22 16:03:57 UTC (rev 76) @@ -7,13 +7,21 @@ typedef struct { - XShmSegmentInfo shm; - AVPicture rgb_frame; - enum PixelFormat out_format; - ImgReSampleContext *resize_ctx; - AVPicture resized_frame; - uint8_t *tmpbuf_data; + unsigned int width; + unsigned int height; +} FrameSize; + +typedef struct +{ XImage *current_frame; /* frame we are currently displaying */ + XShmSegmentInfo shm; /* shared memory used by current_frame */ + AVPicture rgb_frame; /* ffmpeg wrapper for current_frame SHM data */ + enum PixelFormat out_format; /* rgb_frame ffmpeg pixel format */ + ImgReSampleContext *resize_ctx; /* NULL if we do not need to resize the frame */ + FrameSize resize_in; /* resize_ctx input dimensions */ + FrameSize resize_out; /* resize_ctx output dimensions */ + AVPicture resized_frame; /* resized output frame */ + uint8_t *resized_data; /* resized_frame data buffer */ } MHEGVideoOutput; void MHEGVideoOutput_init(MHEGVideoOutput *); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-22 13:57:28
|
Revision: 75 Author: skilvington Date: 2006-05-22 06:57:21 -0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=75&view=rev Log Message: ----------- no need for current_frame_lock Modified Paths: -------------- redbutton-browser/trunk/MHEGVideoOutput.c redbutton-browser/trunk/MHEGVideoOutput.h Modified: redbutton-browser/trunk/MHEGVideoOutput.c =================================================================== --- redbutton-browser/trunk/MHEGVideoOutput.c 2006-05-22 13:30:46 UTC (rev 74) +++ redbutton-browser/trunk/MHEGVideoOutput.c 2006-05-22 13:57:21 UTC (rev 75) @@ -52,7 +52,6 @@ void x11_shm_init(MHEGVideoOutput *v) { - pthread_mutex_init(&v->current_frame_lock, NULL); v->current_frame = NULL; v->resize_ctx = NULL; @@ -74,8 +73,6 @@ if(v->current_frame != NULL) x11_shm_destroy_frame(v); - pthread_mutex_destroy(&v->current_frame_lock); - return; } @@ -116,9 +113,7 @@ } /* convert the frame to RGB */ - pthread_mutex_lock(&v->current_frame_lock); img_convert(&v->rgb_frame, v->out_format, yuv_frame, f->pix_fmt, out_width, out_height); - pthread_mutex_unlock(&v->current_frame_lock); return; } @@ -130,9 +125,6 @@ unsigned int out_width; unsigned int out_height; -/* TODO */ -/* probably dont need this lock anymore, only we use v->current_frame */ - pthread_mutex_lock(&v->current_frame_lock); if(v->current_frame != NULL) { /* video frame is already scaled as needed */ @@ -143,7 +135,6 @@ /* get it drawn straight away */ XFlush(d->dpy); } - pthread_mutex_unlock(&v->current_frame_lock); return; } @@ -203,13 +194,11 @@ MHEGDisplay *d = MHEGEngine_getDisplay(); /* get rid of the current frame */ - pthread_mutex_lock(&v->current_frame_lock); /* the XImage data is our shared memory, make sure XDestroyImage doesn't try to free it */ v->current_frame->data = NULL; XDestroyImage(v->current_frame); /* make sure no-one tries to use it */ v->current_frame = NULL; - pthread_mutex_unlock(&v->current_frame_lock); XShmDetach(d->dpy, &v->shm); shmdt(v->shm.shmaddr); Modified: redbutton-browser/trunk/MHEGVideoOutput.h =================================================================== --- redbutton-browser/trunk/MHEGVideoOutput.h 2006-05-22 13:30:46 UTC (rev 74) +++ redbutton-browser/trunk/MHEGVideoOutput.h 2006-05-22 13:57:21 UTC (rev 75) @@ -13,7 +13,6 @@ ImgReSampleContext *resize_ctx; AVPicture resized_frame; uint8_t *tmpbuf_data; - pthread_mutex_t current_frame_lock; /* locked when we are updating current frame */ XImage *current_frame; /* frame we are currently displaying */ } MHEGVideoOutput; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-22 13:31:01
|
Revision: 74 Author: skilvington Date: 2006-05-22 06:30:46 -0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=74&view=rev Log Message: ----------- bug fix Modified Paths: -------------- redbutton-browser/trunk/MHEGVideoOutput.c redbutton-browser/trunk/MHEGVideoOutput.h Modified: redbutton-browser/trunk/MHEGVideoOutput.c =================================================================== --- redbutton-browser/trunk/MHEGVideoOutput.c 2006-05-22 12:58:15 UTC (rev 73) +++ redbutton-browser/trunk/MHEGVideoOutput.c 2006-05-22 13:30:46 UTC (rev 74) @@ -82,7 +82,6 @@ void x11_shm_prepareFrame(MHEGVideoOutput *v, VideoFrame *f, unsigned int out_width, unsigned int out_height) { - AVPicture resized_frame; AVPicture *yuv_frame; int tmpbuf_size; @@ -106,10 +105,10 @@ v->resize_ctx = img_resample_init(out_width, out_height, f->width, f->height); tmpbuf_size = avpicture_get_size(f->pix_fmt, out_width, out_height); v->tmpbuf_data = safe_malloc(tmpbuf_size); - avpicture_fill(&resized_frame, v->tmpbuf_data, f->pix_fmt, out_width, out_height); + avpicture_fill(&v->resized_frame, v->tmpbuf_data, f->pix_fmt, out_width, out_height); } - img_resample(v->resize_ctx, &resized_frame, &f->frame); - yuv_frame = &resized_frame; + img_resample(v->resize_ctx, &v->resized_frame, &f->frame); + yuv_frame = &v->resized_frame; } else { Modified: redbutton-browser/trunk/MHEGVideoOutput.h =================================================================== --- redbutton-browser/trunk/MHEGVideoOutput.h 2006-05-22 12:58:15 UTC (rev 73) +++ redbutton-browser/trunk/MHEGVideoOutput.h 2006-05-22 13:30:46 UTC (rev 74) @@ -11,6 +11,7 @@ AVPicture rgb_frame; enum PixelFormat out_format; ImgReSampleContext *resize_ctx; + AVPicture resized_frame; uint8_t *tmpbuf_data; pthread_mutex_t current_frame_lock; /* locked when we are updating current frame */ XImage *current_frame; /* frame we are currently displaying */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-22 12:58:20
|
Revision: 73 Author: skilvington Date: 2006-05-22 05:58:15 -0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=73&view=rev Log Message: ----------- allow video to change size mid-stream Modified Paths: -------------- redbutton-browser/trunk/MHEGVideoOutput.c Modified: redbutton-browser/trunk/MHEGVideoOutput.c =================================================================== --- redbutton-browser/trunk/MHEGVideoOutput.c 2006-05-22 12:49:25 UTC (rev 72) +++ redbutton-browser/trunk/MHEGVideoOutput.c 2006-05-22 12:58:15 UTC (rev 73) @@ -20,6 +20,7 @@ void x11_shm_drawFrame(MHEGVideoOutput *, int, int); static void x11_shm_create_frame(MHEGVideoOutput *, unsigned int, unsigned int); +static void x11_shm_resize_frame(MHEGVideoOutput *, unsigned int, unsigned int); static void x11_shm_destroy_frame(MHEGVideoOutput *); static enum PixelFormat find_av_pix_fmt(int, unsigned long, unsigned long, unsigned long); @@ -85,18 +86,19 @@ AVPicture *yuv_frame; int tmpbuf_size; - /* see if the output size has changed since the last frame */ -/* TODO if it has, delete the old one or just resize shm etc */ -/* will also need to delete resize_ctx */ - + /* have we create the output frame yet */ if(v->current_frame == NULL) x11_shm_create_frame(v, out_width, out_height); + /* see if the output size has changed since the last frame */ + if(v->current_frame->width != out_width || v->current_frame->height != out_height) + x11_shm_resize_frame(v, out_width, out_height); + /* see if the input size is different than the output size */ if(f->width != out_width || f->height != out_height) { /* TODO */ -/* need to change resize_ctx if vf->width or vf->height have changed since last time */ +/* need to change resize_ctx if the input or output sizes have changed since last time */ /* dont forget: img_resample_close(resize_ctx); */ /* and to free or realloc tmpbuf_data */ if(v->resize_ctx == NULL) @@ -182,6 +184,21 @@ } static void +x11_shm_resize_frame(MHEGVideoOutput *v, unsigned int out_width, unsigned int out_height) +{ +/* TODO */ +/* better if create_frame makes the max size shm we will need (ie d->xres, d->yres) */ +/* then this just updates the XImage and AVFrame params in current_frame and rgb_frame */ + + if(v->current_frame != NULL) + x11_shm_destroy_frame(v); + + x11_shm_create_frame(v, out_width, out_height); + + return; +} + +static void x11_shm_destroy_frame(MHEGVideoOutput *v) { MHEGDisplay *d = MHEGEngine_getDisplay(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-22 12:49:33
|
Revision: 72 Author: skilvington Date: 2006-05-22 05:49:25 -0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=72&view=rev Log Message: ----------- cope with video changing size mid-stream Modified Paths: -------------- redbutton-browser/trunk/MHEGStreamPlayer.c Modified: redbutton-browser/trunk/MHEGStreamPlayer.c =================================================================== --- redbutton-browser/trunk/MHEGStreamPlayer.c 2006-05-22 08:31:19 UTC (rev 71) +++ redbutton-browser/trunk/MHEGStreamPlayer.c 2006-05-22 12:49:25 UTC (rev 72) @@ -354,19 +354,6 @@ /* initialise the video output method */ MHEGVideoOutput_init(&vo); - /* size of first frame, no need to lock as item won't change */ - out_width = p->videoq->item.width; - out_height = p->videoq->item.height; -/* TODO */ -/* use scaled values if ScaleVideo has been called */ - /* scale up if fullscreen */ - if(d->fullscreen) - { - out_width = (out_width * d->xres) / MHEG_XRES; - out_height = (out_height * d->yres) / MHEG_YRES; - } - - /* the time that we displayed the previous frame */ last_time = 0; last_pts = 0; @@ -413,6 +400,16 @@ if(!drop_frame) { /* scale the next frame if necessary */ + out_width = vf->width; + out_height = vf->height; +/* TODO */ +/* use scaled values if ScaleVideo has been called */ + /* scale up if fullscreen */ + if(d->fullscreen) + { + out_width = (out_width * d->xres) / MHEG_XRES; + out_height = (out_height * d->yres) / MHEG_YRES; + } MHEGVideoOutput_prepareFrame(&vo, vf, out_width, out_height); /* wait until it's time to display the frame */ now = av_gettime(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-22 08:31:33
|
Revision: 71 Author: skilvington Date: 2006-05-22 01:31:19 -0700 (Mon, 22 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=71&view=rev Log Message: ----------- abstract out the video output method Modified Paths: -------------- redbutton-browser/trunk/MHEGStreamPlayer.c redbutton-browser/trunk/MHEGStreamPlayer.h redbutton-browser/trunk/Makefile Added Paths: ----------- redbutton-browser/trunk/MHEGVideoOutput.c redbutton-browser/trunk/MHEGVideoOutput.h Modified: redbutton-browser/trunk/MHEGStreamPlayer.c =================================================================== --- redbutton-browser/trunk/MHEGStreamPlayer.c 2006-05-19 16:13:56 UTC (rev 70) +++ redbutton-browser/trunk/MHEGStreamPlayer.c 2006-05-22 08:31:19 UTC (rev 71) @@ -4,13 +4,12 @@ #include <string.h> #include <stdio.h> -#include <sys/ipc.h> -#include <sys/shm.h> #include <X11/Xlib.h> #include <X11/extensions/XShm.h> #include "MHEGEngine.h" #include "MHEGStreamPlayer.h" +#include "MHEGVideoOutput.h" #include "mpegts.h" #include "utils.h" @@ -19,7 +18,6 @@ static void *video_thread(void *); static void thread_usleep(unsigned long); -static enum PixelFormat find_av_pix_fmt(int, unsigned long, unsigned long, unsigned long); static enum CodecID find_av_codec_id(int); LIST_TYPE(VideoFrame) * @@ -73,9 +71,6 @@ p->videoq_len = 0; p->videoq = NULL; - pthread_mutex_init(&p->current_frame_lock, NULL); - p->current_frame = NULL; - return; } @@ -85,7 +80,6 @@ MHEGStreamPlayer_stop(p); pthread_mutex_destroy(&p->videoq_lock); - pthread_mutex_destroy(&p->current_frame_lock); return; } @@ -311,23 +305,17 @@ { MHEGStreamPlayer *p = (MHEGStreamPlayer *) arg; MHEGDisplay *d = MHEGEngine_getDisplay(); - unsigned int out_width = 0; /* keep the compiler happy */ - unsigned int out_height = 0; + MHEGVideoOutput vo; + int out_x; + int out_y; + unsigned int out_width; + unsigned int out_height; VideoFrame *vf; - AVPicture rgb_frame; - int rgb_size; - XShmSegmentInfo shm; - enum PixelFormat out_format; double buffered; double last_pts; int64_t last_time, this_time, now; int usecs; bool drop_frame; - ImgReSampleContext *resize_ctx = NULL; - AVPicture resized_frame; - AVPicture *yuv_frame; - int tmpbuf_size; - uint8_t *tmpbuf_data = NULL; unsigned int nframes = 0; if(!p->have_video) @@ -363,42 +351,22 @@ if(p->videoq == NULL) fatal("video_thread: no frames!"); + /* initialise the video output method */ + MHEGVideoOutput_init(&vo); + /* size of first frame, no need to lock as item won't change */ out_width = p->videoq->item.width; out_height = p->videoq->item.height; /* TODO */ -/* also scale if ScaleVideo has been called */ +/* use scaled values if ScaleVideo has been called */ + /* scale up if fullscreen */ if(d->fullscreen) { out_width = (out_width * d->xres) / MHEG_XRES; out_height = (out_height * d->yres) / MHEG_YRES; } - if((p->current_frame = XShmCreateImage(d->dpy, d->vis, d->depth, ZPixmap, NULL, &shm, out_width, out_height)) == NULL) - fatal("XShmCreateImage failed"); - /* work out what ffmpeg pixel format matches our XImage format */ - if((out_format = find_av_pix_fmt(p->current_frame->bits_per_pixel, - d->vis->red_mask, d->vis->green_mask, d->vis->blue_mask)) == PIX_FMT_NONE) - fatal("Unsupported XImage pixel format"); - - rgb_size = p->current_frame->bytes_per_line * out_height; - - if(rgb_size != avpicture_get_size(out_format, out_width, out_height)) - fatal("XImage and ffmpeg pixel formats differ"); - - if((shm.shmid = shmget(IPC_PRIVATE, rgb_size, IPC_CREAT | 0777)) == -1) - fatal("shmget failed"); - if((shm.shmaddr = shmat(shm.shmid, NULL, 0)) == (void *) -1) - fatal("shmat failed"); - shm.readOnly = True; - if(!XShmAttach(d->dpy, &shm)) - fatal("XShmAttach failed"); - - /* we made sure these pixel formats are the same */ - p->current_frame->data = shm.shmaddr; - avpicture_fill(&rgb_frame, shm.shmaddr, out_format, out_width, out_height); - /* the time that we displayed the previous frame */ last_time = 0; last_pts = 0; @@ -444,35 +412,8 @@ //printf("dropped frame %d: pts=%f last_pts=%f last_time=%lld this_time=%lld usecs=%d\n", nframes, vf->pts, last_pts, last_time, this_time, usecs); if(!drop_frame) { - /* see if the output size has changed */ -/* TODO */ /* scale the next frame if necessary */ - if(vf->width != out_width || vf->height != out_height) - { -/* TODO */ -/* need to change resize_ctx if vf->width or vf->height have changed since last time */ -/* dont forget: img_resample_close(resize_ctx); */ -/* and to free or realloc tmpbuf_data */ - if(resize_ctx == NULL) - { - resize_ctx = img_resample_init(out_width, out_height, vf->width, vf->height); - tmpbuf_size = avpicture_get_size(vf->pix_fmt, out_width, out_height); - tmpbuf_data = safe_malloc(tmpbuf_size); - avpicture_fill(&resized_frame, tmpbuf_data, vf->pix_fmt, out_width, out_height); - } - img_resample(resize_ctx, &resized_frame, &vf->frame); - yuv_frame = &resized_frame; - } - else - { - yuv_frame = &vf->frame; - } - /* make sure no-one else is using the RGB frame */ - pthread_mutex_lock(&p->current_frame_lock); - /* convert the next frame to RGB */ - img_convert(&rgb_frame, out_format, yuv_frame, vf->pix_fmt, out_width, out_height); - /* we've finished changing the RGB frame now */ - pthread_mutex_unlock(&p->current_frame_lock); + MHEGVideoOutput_prepareFrame(&vo, vf, out_width, out_height); /* wait until it's time to display the frame */ now = av_gettime(); /* don't wait if this is the first frame */ @@ -495,8 +436,18 @@ last_pts = vf->pts; //now=av_gettime(); //printf("display frame %d: pts=%f this_time=%lld real_time=%lld (diff=%lld)\n", ++nframes, vf->pts, last_time, now, now-last_time); + /* origin of VideoClass */ +/* TODO should probably have a lock for this in case we are doing SetPosition in another thread */ + out_x = p->video->inst.Position.x_position; + out_y = p->video->inst.Position.y_position; + /* scale if fullscreen */ + if(d->fullscreen) + { + out_x = (out_x * d->xres) / MHEG_XRES; + out_y = (out_y * d->yres) / MHEG_YRES; + } /* draw the current frame */ - MHEGStreamPlayer_drawCurrentFrame(p); + MHEGVideoOutput_drawFrame(&vo, out_x, out_y); /* redraw objects above the video */ MHEGDisplay_refresh(d, &p->video->inst.Position, &p->video->inst.BoxSize); /* get it drawn straight away */ @@ -515,64 +466,13 @@ pthread_yield(); } - if(resize_ctx != NULL) - { - img_resample_close(resize_ctx); - safe_free(tmpbuf_data); - } + MHEGVideoOutput_fini(&vo); - /* get rid of the current frame */ - pthread_mutex_lock(&p->current_frame_lock); - /* the XImage data is our shared memory, make sure XDestroyImage doesn't try to free it */ - p->current_frame->data = NULL; - XDestroyImage(p->current_frame); - /* make sure no-one tries to use it */ - p->current_frame = NULL; - pthread_mutex_unlock(&p->current_frame_lock); - - XShmDetach(d->dpy, &shm); - shmdt(shm.shmaddr); - shmctl(shm.shmid, IPC_RMID, NULL); - verbose("MHEGStreamPlayer: video thread stopped"); return NULL; } -void -MHEGStreamPlayer_drawCurrentFrame(MHEGStreamPlayer *p) -{ - MHEGDisplay *d = MHEGEngine_getDisplay(); - int x, y; - unsigned int out_width; - unsigned int out_height; - - pthread_mutex_lock(&p->current_frame_lock); - if(p->current_frame != NULL) - { - /* origin of VideoClass */ -/* TODO should probably have a lock for this in case we are doing SetPosition in another thread */ - x = p->video->inst.Position.x_position; - y = p->video->inst.Position.y_position; - /* scale if fullscreen */ - if(d->fullscreen) - { - x = (x * d->xres) / MHEG_XRES; - y = (y * d->yres) / MHEG_YRES; - } - /* video frame is already scaled as needed */ - out_width = p->current_frame->width; - out_height = p->current_frame->height; - /* draw it onto the Window contents Pixmap */ - XShmPutImage(d->dpy, d->contents, d->win_gc, p->current_frame, 0, 0, x, y, out_width, out_height, False); - /* get it drawn straight away */ - XFlush(d->dpy); - } - pthread_mutex_unlock(&p->current_frame_lock); - - return; -} - /* * usleep(usecs) * need to make sure the other threads get a go while we are sleeping @@ -592,48 +492,6 @@ } /* - * returns a PIX_FMT_xxx type that matches the given bits per pixel and RGB bit mask values - * returns PIX_FMT_NONE if none match - */ - -static enum PixelFormat -find_av_pix_fmt(int bpp, unsigned long rmask, unsigned long gmask, unsigned long bmask) -{ - enum PixelFormat fmt; - - fmt = PIX_FMT_NONE; - switch(bpp) - { - case 32: - if(rmask == 0xff0000 && gmask == 0xff00 && bmask == 0xff) - fmt = PIX_FMT_RGBA32; - break; - - case 24: - if(rmask == 0xff0000 && gmask == 0xff00 && bmask == 0xff) - fmt = PIX_FMT_RGB24; - else if(rmask == 0xff && gmask == 0xff00 && bmask == 0xff0000) - fmt = PIX_FMT_BGR24; - break; - - case 16: - if(rmask == 0xf800 && gmask == 0x07e0 && bmask == 0x001f) - fmt = PIX_FMT_RGB565; - else if(rmask == 0x7c00 && gmask == 0x03e0 && bmask == 0x001f) - fmt = PIX_FMT_RGB555; - break; - - default: - break; - } - - if(fmt == PIX_FMT_NONE) - error("Unsupported pixel format (bpp=%d r=%lx g=%lx b=%lx)", bpp, rmask, gmask, bmask); - - return fmt; -} - -/* * from libavformat/mpegts.c */ Modified: redbutton-browser/trunk/MHEGStreamPlayer.h =================================================================== --- redbutton-browser/trunk/MHEGStreamPlayer.h 2006-05-19 16:13:56 UTC (rev 70) +++ redbutton-browser/trunk/MHEGStreamPlayer.h 2006-05-22 08:31:19 UTC (rev 71) @@ -35,25 +35,23 @@ /* player state */ typedef struct { - bool playing; /* true when our threads are active */ - bool stop; /* true => stop playback */ - bool have_video; /* false if we have no video stream */ - bool have_audio; /* false if we have no audio stream */ - int video_tag; /* video stream component tag (-1 => default for current service ID) */ - int video_pid; /* PID in MPEG Transport Stream (-1 => not yet known) */ - int video_type; /* video stream type (-1 => not yet known) */ - int audio_tag; /* audio stream component tag (-1 => default for current service ID) */ - int audio_pid; /* PID in MPEG Transport Stream (-1 => not yet known) */ - int audio_type; /* audio stream type (-1 => not yet known) */ - FILE *ts; /* MPEG Transport Stream */ - VideoClass *video; /* output size/position, maybe NULL if audio only */ - pthread_t decode_tid; /* thread decoding the MPEG stream into frames */ - pthread_t video_tid; /* thread displaying frames on the screen */ - pthread_mutex_t videoq_lock; /* list of decoded video frames */ - unsigned int videoq_len; /* number of frames on the videoq */ - LIST_OF(VideoFrame) *videoq; /* head of list is next to be displayed */ - pthread_mutex_t current_frame_lock; /* locked when we are updating current frame */ - XImage *current_frame; /* frame we are currently displaying */ + bool playing; /* true when our threads are active */ + bool stop; /* true => stop playback */ + bool have_video; /* false if we have no video stream */ + bool have_audio; /* false if we have no audio stream */ + int video_tag; /* video stream component tag (-1 => default for current service ID) */ + int video_pid; /* PID in MPEG Transport Stream (-1 => not yet known) */ + int video_type; /* video stream type (-1 => not yet known) */ + int audio_tag; /* audio stream component tag (-1 => default for current service ID) */ + int audio_pid; /* PID in MPEG Transport Stream (-1 => not yet known) */ + int audio_type; /* audio stream type (-1 => not yet known) */ + FILE *ts; /* MPEG Transport Stream */ + VideoClass *video; /* output size/position, maybe NULL if audio only */ + pthread_t decode_tid; /* thread decoding the MPEG stream into frames */ + pthread_t video_tid; /* thread displaying frames on the screen */ + pthread_mutex_t videoq_lock; /* list of decoded video frames */ + unsigned int videoq_len; /* number of frames on the videoq */ + LIST_OF(VideoFrame) *videoq; /* head of list is next to be displayed */ } MHEGStreamPlayer; void MHEGStreamPlayer_init(MHEGStreamPlayer *); Added: redbutton-browser/trunk/MHEGVideoOutput.c =================================================================== --- redbutton-browser/trunk/MHEGVideoOutput.c (rev 0) +++ redbutton-browser/trunk/MHEGVideoOutput.c 2006-05-22 08:31:19 UTC (rev 71) @@ -0,0 +1,246 @@ +/* + * MHEGVideoOutput.h + */ + +#include <pthread.h> +#include <sys/ipc.h> +#include <sys/shm.h> +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <X11/extensions/XShm.h> +#include <ffmpeg/avformat.h> + +#include "MHEGEngine.h" +#include "MHEGVideoOutput.h" +#include "utils.h" + +void x11_shm_init(MHEGVideoOutput *); +void x11_shm_fini(MHEGVideoOutput *); +void x11_shm_prepareFrame(MHEGVideoOutput *, VideoFrame *, unsigned int, unsigned int); +void x11_shm_drawFrame(MHEGVideoOutput *, int, int); + +static void x11_shm_create_frame(MHEGVideoOutput *, unsigned int, unsigned int); +static void x11_shm_destroy_frame(MHEGVideoOutput *); + +static enum PixelFormat find_av_pix_fmt(int, unsigned long, unsigned long, unsigned long); + +void +MHEGVideoOutput_init(MHEGVideoOutput *v) +{ + return x11_shm_init(v); +} + +void +MHEGVideoOutput_fini(MHEGVideoOutput *v) +{ + return x11_shm_fini(v); +} + +void +MHEGVideoOutput_prepareFrame(MHEGVideoOutput *v, VideoFrame *f, unsigned int out_width, unsigned int out_height) +{ + return x11_shm_prepareFrame(v, f, out_width, out_height); +} + +void +MHEGVideoOutput_drawFrame(MHEGVideoOutput *v, int x, int y) +{ + return x11_shm_drawFrame(v, x, y); +} + +void +x11_shm_init(MHEGVideoOutput *v) +{ + pthread_mutex_init(&v->current_frame_lock, NULL); + v->current_frame = NULL; + + v->resize_ctx = NULL; + + v->tmpbuf_data = NULL; + + return; +} + +void +x11_shm_fini(MHEGVideoOutput *v) +{ + if(v->resize_ctx != NULL) + { + img_resample_close(v->resize_ctx); + safe_free(v->tmpbuf_data); + } + + if(v->current_frame != NULL) + x11_shm_destroy_frame(v); + + pthread_mutex_destroy(&v->current_frame_lock); + + return; +} + +void +x11_shm_prepareFrame(MHEGVideoOutput *v, VideoFrame *f, unsigned int out_width, unsigned int out_height) +{ + AVPicture resized_frame; + AVPicture *yuv_frame; + int tmpbuf_size; + + /* see if the output size has changed since the last frame */ +/* TODO if it has, delete the old one or just resize shm etc */ +/* will also need to delete resize_ctx */ + + if(v->current_frame == NULL) + x11_shm_create_frame(v, out_width, out_height); + + /* see if the input size is different than the output size */ + if(f->width != out_width || f->height != out_height) + { +/* TODO */ +/* need to change resize_ctx if vf->width or vf->height have changed since last time */ +/* dont forget: img_resample_close(resize_ctx); */ +/* and to free or realloc tmpbuf_data */ + if(v->resize_ctx == NULL) + { + v->resize_ctx = img_resample_init(out_width, out_height, f->width, f->height); + tmpbuf_size = avpicture_get_size(f->pix_fmt, out_width, out_height); + v->tmpbuf_data = safe_malloc(tmpbuf_size); + avpicture_fill(&resized_frame, v->tmpbuf_data, f->pix_fmt, out_width, out_height); + } + img_resample(v->resize_ctx, &resized_frame, &f->frame); + yuv_frame = &resized_frame; + } + else + { + yuv_frame = &f->frame; + } + + /* convert the frame to RGB */ + pthread_mutex_lock(&v->current_frame_lock); + img_convert(&v->rgb_frame, v->out_format, yuv_frame, f->pix_fmt, out_width, out_height); + pthread_mutex_unlock(&v->current_frame_lock); + + return; +} + +void +x11_shm_drawFrame(MHEGVideoOutput *v, int x, int y) +{ + MHEGDisplay *d = MHEGEngine_getDisplay(); + unsigned int out_width; + unsigned int out_height; + +/* TODO */ +/* probably dont need this lock anymore, only we use v->current_frame */ + pthread_mutex_lock(&v->current_frame_lock); + if(v->current_frame != NULL) + { + /* video frame is already scaled as needed */ + out_width = v->current_frame->width; + out_height = v->current_frame->height; + /* draw it onto the Window contents Pixmap */ + XShmPutImage(d->dpy, d->contents, d->win_gc, v->current_frame, 0, 0, x, y, out_width, out_height, False); + /* get it drawn straight away */ + XFlush(d->dpy); + } + pthread_mutex_unlock(&v->current_frame_lock); + + return; +} + +static void +x11_shm_create_frame(MHEGVideoOutput *v, unsigned int out_width, unsigned int out_height) +{ + MHEGDisplay *d = MHEGEngine_getDisplay(); + int rgb_size; + + if((v->current_frame = XShmCreateImage(d->dpy, d->vis, d->depth, ZPixmap, NULL, &v->shm, out_width, out_height)) == NULL) + fatal("XShmCreateImage failed"); + + /* work out what ffmpeg pixel format matches our XImage format */ + if((v->out_format = find_av_pix_fmt(v->current_frame->bits_per_pixel, + d->vis->red_mask, d->vis->green_mask, d->vis->blue_mask)) == PIX_FMT_NONE) + fatal("Unsupported XImage pixel format"); + + rgb_size = v->current_frame->bytes_per_line * out_height; + + if(rgb_size != avpicture_get_size(v->out_format, out_width, out_height)) + fatal("XImage and ffmpeg pixel formats differ"); + + if((v->shm.shmid = shmget(IPC_PRIVATE, rgb_size, IPC_CREAT | 0777)) == -1) + fatal("shmget failed"); + if((v->shm.shmaddr = shmat(v->shm.shmid, NULL, 0)) == (void *) -1) + fatal("shmat failed"); + v->shm.readOnly = True; + if(!XShmAttach(d->dpy, &v->shm)) + fatal("XShmAttach failed"); + + /* we made sure these pixel formats are the same */ + v->current_frame->data = v->shm.shmaddr; + avpicture_fill(&v->rgb_frame, v->shm.shmaddr, v->out_format, out_width, out_height); + + return; +} + +static void +x11_shm_destroy_frame(MHEGVideoOutput *v) +{ + MHEGDisplay *d = MHEGEngine_getDisplay(); + + /* get rid of the current frame */ + pthread_mutex_lock(&v->current_frame_lock); + /* the XImage data is our shared memory, make sure XDestroyImage doesn't try to free it */ + v->current_frame->data = NULL; + XDestroyImage(v->current_frame); + /* make sure no-one tries to use it */ + v->current_frame = NULL; + pthread_mutex_unlock(&v->current_frame_lock); + + XShmDetach(d->dpy, &v->shm); + shmdt(v->shm.shmaddr); + shmctl(v->shm.shmid, IPC_RMID, NULL); + + return; +} + +/* + * returns a PIX_FMT_xxx type that matches the given bits per pixel and RGB bit mask values + * returns PIX_FMT_NONE if none match + */ + +static enum PixelFormat +find_av_pix_fmt(int bpp, unsigned long rmask, unsigned long gmask, unsigned long bmask) +{ + enum PixelFormat fmt; + + fmt = PIX_FMT_NONE; + switch(bpp) + { + case 32: + if(rmask == 0xff0000 && gmask == 0xff00 && bmask == 0xff) + fmt = PIX_FMT_RGBA32; + break; + + case 24: + if(rmask == 0xff0000 && gmask == 0xff00 && bmask == 0xff) + fmt = PIX_FMT_RGB24; + else if(rmask == 0xff && gmask == 0xff00 && bmask == 0xff0000) + fmt = PIX_FMT_BGR24; + break; + + case 16: + if(rmask == 0xf800 && gmask == 0x07e0 && bmask == 0x001f) + fmt = PIX_FMT_RGB565; + else if(rmask == 0x7c00 && gmask == 0x03e0 && bmask == 0x001f) + fmt = PIX_FMT_RGB555; + break; + + default: + break; + } + + if(fmt == PIX_FMT_NONE) + error("Unsupported pixel format (bpp=%d r=%lx g=%lx b=%lx)", bpp, rmask, gmask, bmask); + + return fmt; +} + Added: redbutton-browser/trunk/MHEGVideoOutput.h =================================================================== --- redbutton-browser/trunk/MHEGVideoOutput.h (rev 0) +++ redbutton-browser/trunk/MHEGVideoOutput.h 2006-05-22 08:31:19 UTC (rev 71) @@ -0,0 +1,26 @@ +/* + * MHEGVideoOutput.h + */ + +#ifndef __MHEGVIDEOOUTPUT_H__ +#define __MHEGVIDEOOUTPUT_H__ + +typedef struct +{ + XShmSegmentInfo shm; + AVPicture rgb_frame; + enum PixelFormat out_format; + ImgReSampleContext *resize_ctx; + uint8_t *tmpbuf_data; + pthread_mutex_t current_frame_lock; /* locked when we are updating current frame */ + XImage *current_frame; /* frame we are currently displaying */ +} MHEGVideoOutput; + +void MHEGVideoOutput_init(MHEGVideoOutput *); +void MHEGVideoOutput_fini(MHEGVideoOutput *); + +void MHEGVideoOutput_prepareFrame(MHEGVideoOutput *, VideoFrame *, unsigned int, unsigned int); +void MHEGVideoOutput_drawFrame(MHEGVideoOutput *, int, int); + +#endif /* __MHEGVIDEOOUTPUT_H__ */ + Modified: redbutton-browser/trunk/Makefile =================================================================== --- redbutton-browser/trunk/Makefile 2006-05-19 16:13:56 UTC (rev 70) +++ redbutton-browser/trunk/Makefile 2006-05-22 08:31:19 UTC (rev 71) @@ -66,6 +66,7 @@ MHEGFont.o \ MHEGTimer.o \ MHEGStreamPlayer.o \ + MHEGVideoOutput.o \ ${CLASSES} \ ISO13522-MHEG-5.o \ der_decode.o \ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-19 16:14:05
|
Revision: 70 Author: skilvington Date: 2006-05-19 09:13:56 -0700 (Fri, 19 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=70&view=rev Log Message: ----------- be less verbose on TS sync errors Modified Paths: -------------- redbutton-browser/trunk/mpegts.c Modified: redbutton-browser/trunk/mpegts.c =================================================================== --- redbutton-browser/trunk/mpegts.c 2006-05-18 18:14:23 UTC (rev 69) +++ redbutton-browser/trunk/mpegts.c 2006-05-19 16:13:56 UTC (rev 70) @@ -34,6 +34,7 @@ #include "mpegts.h" #include "utils.h" +#include "MHEGEngine.h" #define TS_PACKET_SIZE 188 #define NB_PID_MAX 2 @@ -230,8 +231,10 @@ read_packet(FILE *ts, uint8_t *buf) { size_t nread; + unsigned int resync; /* find the next sync byte */ + resync = 0; nread = 0; do { @@ -240,7 +243,7 @@ nread += fread(buf + nread, 1, TS_PACKET_SIZE - nread, ts); if(*buf != TS_SYNC_BYTE && !feof(ts)) { - error("MPEG TS demux: bad sync byte: 0x%02x", *buf); + resync ++; memmove(buf, buf + 1, TS_PACKET_SIZE - 1); nread = TS_PACKET_SIZE - 1; } @@ -250,6 +253,9 @@ if(feof(ts)) return -1; + if(resync > 0) + verbose("MPEG TS demux: lost sync; skipped %u bytes", resync); + return 0; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-18 18:14:29
|
Revision: 69 Author: skilvington Date: 2006-05-18 11:14:23 -0700 (Thu, 18 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=69&view=rev Log Message: ----------- stop one thread hogging the CPU Modified Paths: -------------- redbutton-browser/trunk/MHEGStreamPlayer.c Modified: redbutton-browser/trunk/MHEGStreamPlayer.c =================================================================== --- redbutton-browser/trunk/MHEGStreamPlayer.c 2006-05-17 14:12:37 UTC (rev 68) +++ redbutton-browser/trunk/MHEGStreamPlayer.c 2006-05-18 18:14:23 UTC (rev 69) @@ -149,6 +149,13 @@ if(pthread_create(&p->video_tid, NULL, video_thread, p) != 0) fatal("Unable to create video output thread"); +//{ +// whole machine locks up if you do this +// struct sched_param sp = {1}; +// if(pthread_setschedparam(p->video_tid, SCHED_RR, &sp) != 0) +// error("MHEGStreamPlayer: unable to give video thread realtime priority"); +//} + return; } @@ -262,8 +269,11 @@ pthread_mutex_lock(&p->videoq_lock); p->videoq_len ++; LIST_APPEND(&p->videoq, video_frame); +//printf("decode_thread: add frame: len=%u\n", p->videoq_len); pthread_mutex_unlock(&p->videoq_lock); //printf("decode: got video frame: pts=%f (real pts=%f) width=%d height=%d\n", pts, pkt.pts / video_time_base, video_codec_ctx->width, video_codec_ctx->height); + /* don't want one thread hogging the CPU time */ + pthread_yield(); } } else @@ -494,12 +504,15 @@ } /* we can delete the frame from the queue now */ pthread_mutex_lock(&p->videoq_lock); +//printf("video_thread: free frame: len=%u\n", p->videoq_len); /* assert */ if(p->videoq_len == 0) fatal("video_thread: videoq_len is 0"); p->videoq_len --; LIST_FREE_HEAD(&p->videoq, VideoFrame, free_VideoFrameListItem); pthread_mutex_unlock(&p->videoq_lock); + /* don't want one thread hogging the CPU time */ + pthread_yield(); } if(resize_ctx != NULL) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-17 14:12:47
|
Revision: 68 Author: skilvington Date: 2006-05-17 07:12:37 -0700 (Wed, 17 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=68&view=rev Log Message: ----------- keep track of the number of frames on the videoq Modified Paths: -------------- redbutton-browser/trunk/MHEGStreamPlayer.c redbutton-browser/trunk/MHEGStreamPlayer.h Modified: redbutton-browser/trunk/MHEGStreamPlayer.c =================================================================== --- redbutton-browser/trunk/MHEGStreamPlayer.c 2006-05-16 15:41:12 UTC (rev 67) +++ redbutton-browser/trunk/MHEGStreamPlayer.c 2006-05-17 14:12:37 UTC (rev 68) @@ -70,6 +70,7 @@ p->video = NULL; pthread_mutex_init(&p->videoq_lock, NULL); + p->videoq_len = 0; p->videoq = NULL; pthread_mutex_init(&p->current_frame_lock, NULL); @@ -168,6 +169,7 @@ pthread_join(p->video_tid, NULL); /* clean up */ + p->videoq_len = 0; LIST_FREE(&p->videoq, VideoFrame, free_VideoFrameListItem); if(p->ts != NULL) @@ -258,6 +260,7 @@ pts = pkt.dts / video_time_base; video_frame = new_VideoFrameListItem(pts, video_codec_ctx->pix_fmt, video_codec_ctx->width, video_codec_ctx->height, frame); pthread_mutex_lock(&p->videoq_lock); + p->videoq_len ++; LIST_APPEND(&p->videoq, video_frame); pthread_mutex_unlock(&p->videoq_lock); //printf("decode: got video frame: pts=%f (real pts=%f) width=%d height=%d\n", pts, pkt.pts / video_time_base, video_codec_ctx->width, video_codec_ctx->height); @@ -491,6 +494,10 @@ } /* we can delete the frame from the queue now */ pthread_mutex_lock(&p->videoq_lock); + /* assert */ + if(p->videoq_len == 0) + fatal("video_thread: videoq_len is 0"); + p->videoq_len --; LIST_FREE_HEAD(&p->videoq, VideoFrame, free_VideoFrameListItem); pthread_mutex_unlock(&p->videoq_lock); } Modified: redbutton-browser/trunk/MHEGStreamPlayer.h =================================================================== --- redbutton-browser/trunk/MHEGStreamPlayer.h 2006-05-16 15:41:12 UTC (rev 67) +++ redbutton-browser/trunk/MHEGStreamPlayer.h 2006-05-17 14:12:37 UTC (rev 68) @@ -50,6 +50,7 @@ pthread_t decode_tid; /* thread decoding the MPEG stream into frames */ pthread_t video_tid; /* thread displaying frames on the screen */ pthread_mutex_t videoq_lock; /* list of decoded video frames */ + unsigned int videoq_len; /* number of frames on the videoq */ LIST_OF(VideoFrame) *videoq; /* head of list is next to be displayed */ pthread_mutex_t current_frame_lock; /* locked when we are updating current frame */ XImage *current_frame; /* frame we are currently displaying */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-16 15:41:20
|
Revision: 67 Author: skilvington Date: 2006-05-16 08:41:12 -0700 (Tue, 16 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=67&view=rev Log Message: ----------- take video position into account Modified Paths: -------------- redbutton-browser/trunk/MHEGStreamPlayer.c Modified: redbutton-browser/trunk/MHEGStreamPlayer.c =================================================================== --- redbutton-browser/trunk/MHEGStreamPlayer.c 2006-05-16 13:08:55 UTC (rev 66) +++ redbutton-browser/trunk/MHEGStreamPlayer.c 2006-05-16 15:41:12 UTC (rev 67) @@ -530,11 +530,17 @@ pthread_mutex_lock(&p->current_frame_lock); if(p->current_frame != NULL) { -/* TODO */ -/* take p->video size/position into account */ -/* remeber fullscreen scaling */ - x = 0; /* origin of p->video */ - y = 0; + /* origin of VideoClass */ +/* TODO should probably have a lock for this in case we are doing SetPosition in another thread */ + x = p->video->inst.Position.x_position; + y = p->video->inst.Position.y_position; + /* scale if fullscreen */ + if(d->fullscreen) + { + x = (x * d->xres) / MHEG_XRES; + y = (y * d->yres) / MHEG_YRES; + } + /* video frame is already scaled as needed */ out_width = p->current_frame->width; out_height = p->current_frame->height; /* draw it onto the Window contents Pixmap */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-16 13:09:06
|
Revision: 66 Author: skilvington Date: 2006-05-16 06:08:55 -0700 (Tue, 16 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=66&view=rev Log Message: ----------- TODO updates Modified Paths: -------------- redbutton-browser/trunk/TODO Modified: redbutton-browser/trunk/TODO =================================================================== --- redbutton-browser/trunk/TODO 2006-05-16 13:02:55 UTC (rev 65) +++ redbutton-browser/trunk/TODO 2006-05-16 13:08:55 UTC (rev 66) @@ -1,5 +1,5 @@ -check if default audio/video PID is 0 in rb-download -if it is, avstream fails +in all VisibleClass objects +only redraw them in SetPosition/SetBoxSize/etc if they actually move/change size/etc print avstream error message in rb-browser if openStream fails This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-16 13:03:28
|
Revision: 65 Author: skilvington Date: 2006-05-16 06:02:55 -0700 (Tue, 16 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=65&view=rev Log Message: ----------- remove debug printf's Modified Paths: -------------- redbutton-browser/trunk/MHEGEngine.c Modified: redbutton-browser/trunk/MHEGEngine.c =================================================================== --- redbutton-browser/trunk/MHEGEngine.c 2006-05-16 13:01:32 UTC (rev 64) +++ redbutton-browser/trunk/MHEGEngine.c 2006-05-16 13:02:55 UTC (rev 65) @@ -645,14 +645,10 @@ app = MHEGEngine_getActiveApplication(); -printf("redrawArea: LockCount=%d\n", app->inst.LockCount); - /* only redraw if the display is not locked */ if(app->inst.LockCount > 0) return; -printf("redrawArea: %d: %d,%d %d,%d: start\n", time(NULL), pos->x_position, pos->y_position, box->x_length, box->y_length); - /**************************************************************************************/ /* could do: */ /* MHEGDisplay_setClipRectangle(pos, box); */ @@ -677,13 +673,9 @@ stack = stack->next; } -printf("redrawArea: refresh\n"); - /* refresh the screen */ MHEGDisplay_refresh(&engine.display, pos, box); -printf("redrawArea: end\n"); - return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-16 13:01:45
|
Revision: 64 Author: skilvington Date: 2006-05-16 06:01:32 -0700 (Tue, 16 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=64&view=rev Log Message: ----------- don't redraw overlay if screen is already unlocked Modified Paths: -------------- redbutton-browser/trunk/ApplicationClass.c redbutton-browser/trunk/MHEGEngine.c Modified: redbutton-browser/trunk/ApplicationClass.c =================================================================== --- redbutton-browser/trunk/ApplicationClass.c 2006-05-15 19:23:59 UTC (rev 63) +++ redbutton-browser/trunk/ApplicationClass.c 2006-05-16 13:01:32 UTC (rev 64) @@ -456,17 +456,19 @@ verbose("ApplicationClass: %s; UnlockScreen", ExternalReference_name(&t->rootClass.inst.ref)); + /* if it is not already unlocked */ if(t->inst.LockCount > 0) + { t->inst.LockCount --; - - /* update the screen if it is now unlocked */ - if(t->inst.LockCount == 0) - { - pos.x_position = 0; - pos.y_position = 0; - box.x_length = MHEG_XRES; - box.y_length = MHEG_YRES; - MHEGEngine_redrawArea(&pos, &box); + /* update the screen if it is now unlocked */ + if(t->inst.LockCount == 0) + { + pos.x_position = 0; + pos.y_position = 0; + box.x_length = MHEG_XRES; + box.y_length = MHEG_YRES; + MHEGEngine_redrawArea(&pos, &box); + } } return; Modified: redbutton-browser/trunk/MHEGEngine.c =================================================================== --- redbutton-browser/trunk/MHEGEngine.c 2006-05-15 19:23:59 UTC (rev 63) +++ redbutton-browser/trunk/MHEGEngine.c 2006-05-16 13:01:32 UTC (rev 64) @@ -645,10 +645,14 @@ app = MHEGEngine_getActiveApplication(); +printf("redrawArea: LockCount=%d\n", app->inst.LockCount); + /* only redraw if the display is not locked */ if(app->inst.LockCount > 0) return; +printf("redrawArea: %d: %d,%d %d,%d: start\n", time(NULL), pos->x_position, pos->y_position, box->x_length, box->y_length); + /**************************************************************************************/ /* could do: */ /* MHEGDisplay_setClipRectangle(pos, box); */ @@ -673,9 +677,13 @@ stack = stack->next; } +printf("redrawArea: refresh\n"); + /* refresh the screen */ MHEGDisplay_refresh(&engine.display, pos, box); +printf("redrawArea: end\n"); + return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-15 19:24:18
|
Revision: 63 Author: skilvington Date: 2006-05-15 12:23:59 -0700 (Mon, 15 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=63&view=rev Log Message: ----------- get ScaleBitmap params Modified Paths: -------------- redbutton-browser/trunk/BitmapClass.c Modified: redbutton-browser/trunk/BitmapClass.c =================================================================== --- redbutton-browser/trunk/BitmapClass.c 2006-05-15 19:01:46 UTC (rev 62) +++ redbutton-browser/trunk/BitmapClass.c 2006-05-15 19:23:59 UTC (rev 63) @@ -412,10 +412,16 @@ void BitmapClass_ScaleBitmap(BitmapClass *t, ScaleBitmap *params, OctetString *caller_gid) { + int x_scale; + int y_scale; + verbose("BitmapClass: %s; ScaleBitmap", ExternalReference_name(&t->rootClass.inst.ref)); + x_scale = GenericInteger_getInteger(¶ms->x_scale, caller_gid); + y_scale = GenericInteger_getInteger(¶ms->y_scale, caller_gid); + /* TODO */ -printf("TODO: BitmapClass_ScaleBitmap not yet implemented\n"); +printf("TODO: BitmapClass_ScaleBitmap(%d, %d) not yet implemented\n", x_scale, y_scale); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-15 19:01:54
|
Revision: 62 Author: skilvington Date: 2006-05-15 12:01:46 -0700 (Mon, 15 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=62&view=rev Log Message: ----------- use correct RGB masks for bitmaps Modified Paths: -------------- redbutton-browser/trunk/MHEGDisplay.c Modified: redbutton-browser/trunk/MHEGDisplay.c =================================================================== --- redbutton-browser/trunk/MHEGDisplay.c 2006-05-15 16:12:00 UTC (rev 61) +++ redbutton-browser/trunk/MHEGDisplay.c 2006-05-15 19:01:46 UTC (rev 62) @@ -846,10 +846,13 @@ } /* get X to draw the XImage onto a Pixmap */ -/* TODO */ -/* this should be the Visual that matches PictStandardARGB32, not d->vis (the Window Visual) */ - if((ximg = XCreateImage(d->dpy, d->vis, 32, ZPixmap, 0, xdata, width, height, 32, 0)) == NULL) + if((ximg = XCreateImage(d->dpy, NULL, 32, ZPixmap, 0, xdata, width, height, 32, 0)) == NULL) fatal("XCreateImage failed"); + /* passed NULL Visual to XCreateImage, so set the rgb masks now */ + ximg->red_mask = pic_format->direct.redMask; + ximg->green_mask = pic_format->direct.greenMask; + ximg->blue_mask = pic_format->direct.blueMask; + /* create the Pixmap */ bitmap->image = XCreatePixmap(d->dpy, d->win, width, height, 32); gc = XCreateGC(d->dpy, bitmap->image, 0, NULL); XPutImage(d->dpy, bitmap->image, gc, ximg, 0, 0, 0, 0, width, height); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-15 16:12:09
|
Revision: 61 Author: skilvington Date: 2006-05-15 09:12:00 -0700 (Mon, 15 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=61&view=rev Log Message: ----------- get ScaleVideo size Modified Paths: -------------- redbutton-browser/trunk/VideoClass.c Modified: redbutton-browser/trunk/VideoClass.c =================================================================== --- redbutton-browser/trunk/VideoClass.c 2006-05-15 13:07:39 UTC (rev 60) +++ redbutton-browser/trunk/VideoClass.c 2006-05-15 16:12:00 UTC (rev 61) @@ -346,10 +346,16 @@ void VideoClass_ScaleVideo(VideoClass *t, ScaleVideo *params, OctetString *caller_gid) { + int x_scale; + int y_scale; + verbose("VideoClass: %s; ScaleVideo", ExternalReference_name(&t->rootClass.inst.ref)); + x_scale = GenericInteger_getInteger(¶ms->x_scale, caller_gid); + y_scale = GenericInteger_getInteger(¶ms->y_scale, caller_gid); + /* TODO */ -printf("TODO: VideoClass_ScaleVideo not yet implemented\n"); +printf("TODO: VideoClass_ScaleVideo(%d, %d) not yet implemented\n", x_scale, y_scale); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-15 13:07:44
|
Revision: 60 Author: skilvington Date: 2006-05-15 06:07:39 -0700 (Mon, 15 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=60&view=rev Log Message: ----------- more TODO Modified Paths: -------------- redbutton-browser/trunk/MHEGDisplay.c Modified: redbutton-browser/trunk/MHEGDisplay.c =================================================================== --- redbutton-browser/trunk/MHEGDisplay.c 2006-05-15 10:55:48 UTC (rev 59) +++ redbutton-browser/trunk/MHEGDisplay.c 2006-05-15 13:07:39 UTC (rev 60) @@ -846,6 +846,8 @@ } /* get X to draw the XImage onto a Pixmap */ +/* TODO */ +/* this should be the Visual that matches PictStandardARGB32, not d->vis (the Window Visual) */ if((ximg = XCreateImage(d->dpy, d->vis, 32, ZPixmap, 0, xdata, width, height, 32, 0)) == NULL) fatal("XCreateImage failed"); bitmap->image = XCreatePixmap(d->dpy, d->win, width, height, 32); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-15 10:55:56
|
Revision: 59 Author: skilvington Date: 2006-05-15 03:55:48 -0700 (Mon, 15 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=59&view=rev Log Message: ----------- return an error if default A/V streams cannot be found Modified Paths: -------------- redbutton-download/trunk/command.c Modified: redbutton-download/trunk/command.c =================================================================== --- redbutton-download/trunk/command.c 2006-05-15 08:49:45 UTC (rev 58) +++ redbutton-download/trunk/command.c 2006-05-15 10:55:48 UTC (rev 59) @@ -152,6 +152,12 @@ /* map the tag to a PID and stream type, or use the default */ if(tag == -1) { + /* check we have a default stream */ + if(car->audio_pid == 0) + { + SEND_RESPONSE(500, "Unable to find audio PID"); + return false; + } pid = car->audio_pid; type = car->audio_type; } @@ -220,6 +226,12 @@ /* map the tag to a PID and stream type, or use the default */ if(tag == -1) { + /* check we have a default stream */ + if(car->video_pid == 0) + { + SEND_RESPONSE(500, "Unable to find video PID"); + return false; + } pid = car->video_pid; type = car->video_type; } @@ -293,6 +305,12 @@ /* map the tags to PIDs and stream types, or use the defaults */ if(audio_tag == -1) { + /* check we have a default stream */ + if(car->audio_pid == 0) + { + SEND_RESPONSE(500, "Unable to find audio PID"); + return false; + } audio_pid = car->audio_pid; audio_type = car->audio_type; } @@ -304,6 +322,12 @@ if(video_tag == -1) { + /* check we have a default stream */ + if(car->video_pid == 0) + { + SEND_RESPONSE(500, "Unable to find video PID"); + return false; + } video_pid = car->video_pid; video_type = car->video_type; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
|
From: <ski...@us...> - 2006-05-15 08:50:05
|
Revision: 58 Author: skilvington Date: 2006-05-15 01:49:45 -0700 (Mon, 15 May 2006) ViewCVS: http://svn.sourceforge.net/redbutton/?rev=58&view=rev Log Message: ----------- remove unused code Modified Paths: -------------- redbutton-browser/trunk/MHEGStreamPlayer.h redbutton-browser/trunk/StreamComponent.c redbutton-browser/trunk/VideoClass.c redbutton-browser/trunk/VideoClass.h redbutton-browser/trunk/add_instance_vars.conf Modified: redbutton-browser/trunk/MHEGStreamPlayer.h =================================================================== --- redbutton-browser/trunk/MHEGStreamPlayer.h 2006-05-14 11:29:37 UTC (rev 57) +++ redbutton-browser/trunk/MHEGStreamPlayer.h 2006-05-15 08:49:45 UTC (rev 58) @@ -33,7 +33,7 @@ void free_VideoFrameListItem(LIST_TYPE(VideoFrame) *); /* player state */ -typedef struct MHEGStreamPlayer +typedef struct { bool playing; /* true when our threads are active */ bool stop; /* true => stop playback */ Modified: redbutton-browser/trunk/StreamComponent.c =================================================================== --- redbutton-browser/trunk/StreamComponent.c 2006-05-14 11:29:37 UTC (rev 57) +++ redbutton-browser/trunk/StreamComponent.c 2006-05-15 08:49:45 UTC (rev 58) @@ -109,7 +109,6 @@ break; case StreamComponent_video: - VideoClass_setStreamPlayer(&s->u.video, player); MHEGStreamPlayer_setVideoTag(player, &s->u.video, s->u.video.component_tag); break; @@ -134,7 +133,6 @@ break; case StreamComponent_video: - VideoClass_setStreamPlayer(&s->u.video, NULL); break; case StreamComponent_rtgraphics: Modified: redbutton-browser/trunk/VideoClass.c =================================================================== --- redbutton-browser/trunk/VideoClass.c 2006-05-14 11:29:37 UTC (rev 57) +++ redbutton-browser/trunk/VideoClass.c 2006-05-15 08:49:45 UTC (rev 58) @@ -354,14 +354,6 @@ } void -VideoClass_setStreamPlayer(VideoClass *t, MHEGStreamPlayer *p) -{ - t->inst.player = p; - - return; -} - -void VideoClass_render(VideoClass *t, MHEGDisplay *d, XYPosition *pos, OriginalBoxSize *box) { XYPosition ins_pos; Modified: redbutton-browser/trunk/VideoClass.h =================================================================== --- redbutton-browser/trunk/VideoClass.h 2006-05-14 11:29:37 UTC (rev 57) +++ redbutton-browser/trunk/VideoClass.h 2006-05-15 08:49:45 UTC (rev 58) @@ -25,7 +25,6 @@ void VideoClass_GetVideoDecodeOffset(VideoClass *, GetVideoDecodeOffset *, OctetString *); void VideoClass_ScaleVideo(VideoClass *, ScaleVideo *, OctetString *); -void VideoClass_setStreamPlayer(VideoClass *, MHEGStreamPlayer *); void VideoClass_render(VideoClass *, MHEGDisplay *, XYPosition *, OriginalBoxSize *); #endif /* __VIDEOCLASS_H__ */ Modified: redbutton-browser/trunk/add_instance_vars.conf =================================================================== --- redbutton-browser/trunk/add_instance_vars.conf 2006-05-14 11:29:37 UTC (rev 57) +++ redbutton-browser/trunk/add_instance_vars.conf 2006-05-15 08:49:45 UTC (rev 58) @@ -175,8 +175,6 @@ /* VideoClass */ /* UK MHEG Profile adds this */ XYPosition VideoDecodeOffset; - /* we add this */ - struct MHEGStreamPlayer *player; } VideoClassInstanceVars; </VideoClass> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |