mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
sys/osxvideo/: Disable the cocoa event loop since it's a huge memory leak. Should only matter if the sink isn't used ...
Original commit message from CVS: * sys/osxvideo/cocoawindow.h: * sys/osxvideo/cocoawindow.m: * sys/osxvideo/osxvideosink.h: * sys/osxvideo/osxvideosink.m: Disable the cocoa event loop since it's a huge memory leak. Should only matter if the sink isn't used within an NSApp (which has already got a coca event loop). Remove all unused code.
This commit is contained in:
parent
5fd12e6dae
commit
bd7b6fc51c
5 changed files with 13 additions and 149 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2007-02-27 Edward Hervey <edward@fluendo.com>
|
||||
|
||||
* sys/osxvideo/cocoawindow.h:
|
||||
* sys/osxvideo/cocoawindow.m:
|
||||
* sys/osxvideo/osxvideosink.h:
|
||||
* sys/osxvideo/osxvideosink.m:
|
||||
Disable the cocoa event loop since it's a huge memory leak. Should only
|
||||
matter if the sink isn't used within an NSApp (which has already got
|
||||
a coca event loop).
|
||||
Remove all unused code.
|
||||
|
||||
2007-02-26 David Schleef <ds@schleef.org>
|
||||
|
||||
* configure.ac:
|
||||
|
|
|
@ -53,21 +53,6 @@ struct _GstOSXImage;
|
|||
|
||||
@end
|
||||
|
||||
@interface GstView : NSQuickDrawView {
|
||||
int width, height;
|
||||
gboolean isPortSet;
|
||||
void* port;
|
||||
/* Quicktime Sequence */
|
||||
ImageSequence qtseqid;
|
||||
ImageDescriptionHandle imgdesc;
|
||||
struct _GstOSXImage* curimg;
|
||||
}
|
||||
- (void) drawRect: (NSRect) rect;
|
||||
- (id) initWithFrame: (NSRect) frame;
|
||||
- (void) setVideoSize: (int) w: (int) h;
|
||||
- (void) setVideoImage: (GstBuffer*) img;
|
||||
@end
|
||||
|
||||
@interface GstOSXVideoSinkWindow: NSWindow {
|
||||
int width, height;
|
||||
GstGLView *gstview;
|
||||
|
|
|
@ -93,103 +93,6 @@
|
|||
|
||||
@end
|
||||
|
||||
//
|
||||
// GstView
|
||||
// Deprecated QuickDraw implementation
|
||||
//
|
||||
|
||||
@ implementation GstView
|
||||
|
||||
- (void) drawRect:(NSRect) rect {
|
||||
/*NSRect bounds = [self bounds];
|
||||
[[NSColor greenColor] set];
|
||||
[NSBezierPath fillRect:bounds]; */
|
||||
[[NSColor blackColor] set];
|
||||
NSRectFill (rect);
|
||||
[super drawRect:rect];
|
||||
}
|
||||
|
||||
- (id) initWithFrame:(NSRect) frame {
|
||||
NSRect bounds =[self bounds];
|
||||
|
||||
[[NSColor greenColor] set];
|
||||
|
||||
self =[super initWithFrame:frame];
|
||||
isPortSet = FALSE;
|
||||
[NSBezierPath fillRect:bounds];
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) setVideoSize: (int) w:(int) h {
|
||||
GST_LOG ("width:%d height:%d", w, h);
|
||||
|
||||
width = w;
|
||||
height = h;
|
||||
}
|
||||
|
||||
- (void) setVideoImage:(GstBuffer *) img {
|
||||
if (isPortSet == FALSE) {
|
||||
// first image
|
||||
//GWorldPtr imgGWorld;
|
||||
//Rect coords;
|
||||
OSErr err;
|
||||
ImageDescriptionPtr pimgdesc;
|
||||
|
||||
err = EnterMovies ();
|
||||
|
||||
if (err != noErr)
|
||||
GST_ERROR ("EnterMovies error: %d", err);
|
||||
/*SetRect(&coords,0,0,width,height);
|
||||
NewGWorldFromPtr (&imgGWorld, kYUV420CodecType, &coords, 0, 0, 0, GST_BUFFER_DATA(img), width * 4);
|
||||
MakeImageDescriptionForPixMap (GetGWorldPixMap(imgGWorld), &imgdesc);
|
||||
DisposeGWorld(imgGWorld); */
|
||||
imgdesc =
|
||||
(ImageDescriptionHandle) NewHandleClear (sizeof (ImageDescription));
|
||||
pimgdesc = *imgdesc;
|
||||
pimgdesc->idSize = sizeof (ImageDescription);
|
||||
pimgdesc->cType = kYUV420CodecType;
|
||||
pimgdesc->version = 1;
|
||||
pimgdesc->revisionLevel = 0;
|
||||
pimgdesc->vendor = 'appl';
|
||||
pimgdesc->width = width;
|
||||
pimgdesc->height = height;
|
||||
pimgdesc->hRes = Long2Fix (72);
|
||||
pimgdesc->vRes = Long2Fix (72);
|
||||
pimgdesc->spatialQuality = codecLosslessQuality;
|
||||
pimgdesc->frameCount = 1;
|
||||
pimgdesc->clutID = -1;
|
||||
pimgdesc->dataSize = 0;
|
||||
pimgdesc->depth = 12;
|
||||
|
||||
[self lockFocus];
|
||||
port =[self qdPort];
|
||||
g_warning ("port = 0x%x", (int) port);
|
||||
err = DecompressSequenceBeginS (&qtseqid, imgdesc, NULL, 0, port, NULL, NULL, NULL, 0, // srcCopy
|
||||
NULL, codecFlagUseImageBuffer, codecLosslessQuality, bestSpeedCodec);
|
||||
if (err != noErr) {
|
||||
GST_DEBUG ("DecompressSequenceBeginS error: %d", err);
|
||||
}
|
||||
[self unlockFocus];
|
||||
isPortSet = TRUE;
|
||||
}
|
||||
|
||||
OSErr err;
|
||||
CodecFlags flags;
|
||||
|
||||
GST_DEBUG ("qtseqid: %d img data: %p size: %d", (int) qtseqid,
|
||||
GST_BUFFER_DATA (img), GST_BUFFER_SIZE (img));
|
||||
err =
|
||||
DecompressSequenceFrameS (qtseqid, (char *) GST_BUFFER_DATA (img),
|
||||
GST_BUFFER_SIZE (img), codecFlagUseImageBuffer, &flags, NULL);
|
||||
if (err != noErr) {
|
||||
GST_DEBUG ("DecompressSequenceS erro: %d", err);
|
||||
} else {
|
||||
//QDFlushPortBuffer (port, nil);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
//
|
||||
// OpenGL implementation
|
||||
|
|
|
@ -52,24 +52,6 @@ typedef struct _GstOSXVideoSinkClass GstOSXVideoSinkClass;
|
|||
|
||||
#define GST_TYPE_OSXVIDEOBUFFER (gst_osxvideobuffer_get_type())
|
||||
|
||||
#define GST_IS_OSXVIDEOBUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_OSXVIDEOBUFFER))
|
||||
#define GST_OSXVIDEOBUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_OSXVIDEOBUFFER, GstOSXVideoBuffer))
|
||||
|
||||
typedef struct _GstOSXVideoBuffer GstOSXVideoBuffer;
|
||||
|
||||
struct _GstOSXVideoBuffer {
|
||||
GstBuffer buffer; /* We extend GstBuffer */
|
||||
|
||||
CVOpenGLTextureRef texture;
|
||||
|
||||
gint width;
|
||||
gint height;
|
||||
|
||||
gboolean locked;
|
||||
|
||||
GstOSXVideoSink *osxvideosink;
|
||||
};
|
||||
|
||||
/* OSXWindow stuff */
|
||||
struct _GstOSXWindow {
|
||||
gint width, height;
|
||||
|
@ -82,9 +64,6 @@ struct _GstOSXVideoSink {
|
|||
/* Our element stuff */
|
||||
GstVideoSink videosink;
|
||||
|
||||
GMutex *pool_lock;
|
||||
GSList *buffer_pool;
|
||||
|
||||
GstOSXWindow *osxwindow;
|
||||
|
||||
gint fps_n;
|
||||
|
|
|
@ -60,6 +60,7 @@ enum
|
|||
static GstVideoSinkClass *parent_class = NULL;
|
||||
|
||||
/* cocoa event loop - needed if not run in own app */
|
||||
/* FIXME : currently disabled since a huge memory leak happens if it is run. */
|
||||
gpointer
|
||||
cocoa_event_loop (GstOSXVideoSink * vsink)
|
||||
{
|
||||
|
@ -108,7 +109,7 @@ gst_osx_video_sink_osxwindow_new (GstOSXVideoSink * osxvideosink, gint width,
|
|||
[pool release];
|
||||
|
||||
/* Start Cocoa event loop */
|
||||
g_thread_create ((GThreadFunc) cocoa_event_loop, osxvideosink, FALSE, NULL);
|
||||
// g_thread_create ((GThreadFunc) cocoa_event_loop, osxvideosink, FALSE, NULL);
|
||||
} else {
|
||||
/* Needs to be embedded */
|
||||
|
||||
|
@ -147,7 +148,6 @@ gst_osx_video_sink_osxwindow_resize (GstOSXVideoSink * osxvideosink,
|
|||
g_return_if_fail (osxwindow != NULL);
|
||||
g_return_if_fail (GST_IS_OSX_VIDEO_SINK (osxvideosink));
|
||||
|
||||
//SizeWindow (osxwindow->win, width, height, 1);
|
||||
osxwindow->width = width;
|
||||
osxwindow->height = height;
|
||||
|
||||
|
@ -341,18 +341,6 @@ gst_osx_video_sink_get_property (GObject * object, guint prop_id,
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gst_osx_video_sink_dispose (GObject * object)
|
||||
{
|
||||
GstOSXVideoSink *osxvideosink;
|
||||
|
||||
osxvideosink = GST_OSX_VIDEO_SINK (object);
|
||||
|
||||
g_mutex_free (osxvideosink->pool_lock);
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_osx_video_sink_init (GstOSXVideoSink * osxvideosink)
|
||||
{
|
||||
|
@ -396,11 +384,9 @@ gst_osx_video_sink_class_init (GstOSXVideoSinkClass * klass)
|
|||
|
||||
parent_class = g_type_class_ref (GST_TYPE_VIDEO_SINK);
|
||||
|
||||
gobject_class->dispose = gst_osx_video_sink_dispose;
|
||||
gobject_class->set_property = gst_osx_video_sink_set_property;
|
||||
gobject_class->get_property = gst_osx_video_sink_get_property;
|
||||
|
||||
//gstbasesink_class->get_times = gst_osx_video_sink_get_times;
|
||||
gstbasesink_class->set_caps = gst_osx_video_sink_setcaps;
|
||||
gstbasesink_class->preroll = gst_osx_video_sink_show_frame;
|
||||
gstbasesink_class->render = gst_osx_video_sink_show_frame;
|
||||
|
|
Loading…
Reference in a new issue