Update code to read NSData, add implementation of open/close in VideoSourceSink.m

This commit is contained in:
Gregory John Casamento 2022-03-28 08:45:17 -04:00
parent a4e417b683
commit 90bbe8d1bf
5 changed files with 13 additions and 5 deletions

View file

@ -38,6 +38,8 @@
@protocol GSVideoSink <NSObject>
+ (BOOL) canInitWithData: (NSData *)d;
/**
* Opens the device for output, called by [NSMovie-play].
*/

View file

@ -152,7 +152,7 @@ static inline void _loadNSMoviePlugIns (void)
{
if ([pluginClass canInitWithData: movieData])
{
_source = [[pluginClass alloc] init];
_source = [[pluginClass alloc] initWithData: movieData];
}
}
END_FOR_IN(__videoSourcePlugIns);

View file

@ -25,7 +25,7 @@ VideoOutput_OBJC_FILES = VideoOutputSink.m
VideoFile_PRINCIPAL_CLASS = VideoFileSource
VideoOutput_PRINCIPAL_CLASS = VidioOutputSink
VideoFile_BUNDLE_LIBS =
VideoOutput_BUNDLE_LIBS =
VideoFile_BUNDLE_LIBS = -lavformat -lavcodec
VideoOutput_BUNDLE_LIBS = -lavformat -lavcodec
include $(GNUSTEP_MAKEFILES)/bundle.make

View file

@ -82,8 +82,8 @@
return nil;
}
_data = data;
RETAIN(_data);
ASSIGN(_data, data);
// NSLog(@"data = %@", _data);
return self;
}

View file

@ -75,6 +75,11 @@
@implementation VideoOutputSink
+ (BOOL) canInitWithData: (NSData *)data
{
return YES; // for now just say yes...
}
- (void) display: (unsigned char *) buf
wrap: (int) wrap
xsize: (int) xsize
@ -90,6 +95,7 @@
fwrite(buf + i * wrap, 1, xsize, f);
fclose(f);
*/
NSLog(@"Playing...");
}