Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create files to support NSMovie and NSMovieView #144

Draft
wants to merge 24 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
04789d7
Add new vars. Implement init.
gcasa Mar 19, 2022
e8be735
Add the beginning of code to handle movie playback
gcasa Mar 20, 2022
d0aa30d
Remove *.nsmovie in video dir
gcasa Mar 20, 2022
04a6633
Add to ignore file.
gcasa Mar 20, 2022
c7f8475
Fix ignore line for AudioFile.nsmovie
gcasa Mar 20, 2022
1948e1e
Intialize file types and GSVideoSource in NSMovie
gcasa Mar 21, 2022
68cc5ad
Fix build. Remove underscores from videoSourcePlugins.
gcasa Mar 22, 2022
896d1bc
Fix compilation error...
gcasa Mar 22, 2022
a4fac88
Set _movie to nil when doing dealloc
gcasa Mar 22, 2022
01b6340
Select plugins for sink and source
gcasa Mar 22, 2022
42b8434
Add documentation
gcasa Mar 23, 2022
e8a936d
Correct documentation
gcasa Mar 23, 2022
eab95f6
Add decoder logic
gcasa Mar 24, 2022
a4e417b
Changes to NSMovie/NSMovieView/GSVideoSink and other classes to suppo…
gcasa Mar 27, 2022
90bbe8d
Update code to read NSData, add implementation of open/close in Video…
gcasa Mar 28, 2022
d42ba86
Fix mathematical error when hitting the end of the stream. Add an err…
gcasa Mar 28, 2022
1994a62
Add errors to give us more of a clue of when something is wrong with …
gcasa Mar 28, 2022
560f2d6
Add ffplay.m -- a port of ffplay.c, to help implement the GSVideoSink…
gcasa Apr 3, 2022
d0d10fb
Non-functional clean build of ffplay.m
gcasa Apr 3, 2022
b4be517
Update configure to find SDL2
gcasa Apr 3, 2022
314fdd8
Update NSMovie.m, start cleaning up ffplay.m
gcasa Apr 3, 2022
4d9e2a6
Remove warnings from ffplay
gcasa Apr 3, 2022
27a3d50
change the name of the main function so that we can call it externally
gcasa Apr 9, 2022
0ba3345
Update so code builds properly
gcasa Jan 15, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Source/Info-gnustep.plist
Tests/gui/*/GNUmakefile
Tools/speech/GSSpeechServer.app
Tools/speech_recognizer/GSSpeechRecognitionServer.app
Tools/sound/AudioOutput.nssound
Tools/sound/Sndfile.nssound
Tools/video/VideoFile.nsmovie
Tools/video/VideoOutput.nsmovie
*~
*.nssound
*.nsmovie
Expand Down
20 changes: 20 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,26 @@
* Source/NSImageCell.m: subclass initImageCell, so that
RefusesFirstResponder can be set, matching Mac.

2022-03-27 Gregory John Casamento <[email protected]>

* config.make.in: Add video flag
* configure.ac: Update to detect avformat.h
* Headers/Additions/GNUstepGUI/GSVideoSink.h
* Headers/Additions/GNUstepGUI/GSVideoSource.h: Add protocol
methods for reading and playing video.
* Headers/AppKit/NSMovie.h: Minor formatting changes.
* Headers/AppKit/NSMovieView.h: Minor formatting changes.
* Headers/AppKit/NSSound.h: Minor formatting changes
* Source/NSMovie.m: Fixes.
* Source/NSMovieView.m: Implement _stream method
* Source/NSSound.m: Minor formatting changes
* Tools/GNUmakefile: Cleanup
* Tools/video/GNUmakefile: Minor fixes
* Tools/video/VideoFileSource.m: Implementation of
readBytes:length: method for reading from the NSData.
* Tools/video/VideoOutputSink.m: Implementation of
playBytes:length: for playing the bytes as a movie.

2022-02-26 Wolfgang Lux <[email protected]>

* Source/NSPopUpButtonCell.m(setMenu:): Select the first item of
Expand Down
83 changes: 83 additions & 0 deletions Headers/Additions/GNUstepGUI/GSVideoSink.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
GSVideoSink.h

Sink video data.

Copyright (C) 2022 Free Software Foundation, Inc.

Written by: Gregory John Casamento <[email protected]>
Date: Mar 2022

This file is part of the GNUstep GUI Library.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/

#ifndef _GNUstep_H_GSVideoSink
#define _GNUstep_H_GSVideoSink

#import <Foundation/NSByteOrder.h>
#import <Foundation/NSObject.h>

@class NSMovie;
@class NSMovieView;

@protocol GSVideoSink <NSObject>

+ (BOOL) canInitWithData: (NSData *)d;

/**
* Opens the device for output, called by [NSMovie-play].
*/
- (BOOL) open;

/** Closes the device, called by [NSMovie-stop].
*/
- (void) close;

/**
* Play the entire video
*/
- (void) play;

/**
* Plays the data in bytes
*/
- (BOOL) playBytes: (void *)bytes length: (NSUInteger)length;

/** Called by [NSMovieView -setVolume:], and corresponds to it. Parameter volume
* is between the values 0.0 and 1.0.
*/
- (void) setVolume: (float)volume;

/** Called by [NSMovieView -volume].
*/
- (CGFloat) volume;

/**
* Sets the view to output to.
*/
- (void) setMovieView: (NSMovieView *)view;

/**
* The movie view
*/
- (NSMovieView *) movieView;

@end

#endif // _GNUstep_H_GSVideoSink
76 changes: 76 additions & 0 deletions Headers/Additions/GNUstepGUI/GSVideoSource.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/*
GSVideoSource.h

Load and read video data.

Copyright (C) 2022 Free Software Foundation, Inc.

Written by: Gregory John Casamento <[email protected]>
Date: Mar 2022

This file is part of the GNUstep GUI Library.

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; see the file COPYING.LIB.
If not, see <http://www.gnu.org/licenses/> or write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/

#ifndef _GNUstep_H_GSVideoSource
#define _GNUstep_H_GSVideoSource

#import <Foundation/NSByteOrder.h>
#import <Foundation/NSObject.h>

@class NSArray;

@protocol GSVideoSource <NSObject>

/** Returns an array of the file types supported by the class.
*/
+ (NSArray *)videoUnfilteredFileTypes;

/** Returns an array of UTIs identifying the file types the class understands.
*/
+ (NSArray *)videoUnfilteredTypes;

/** Returns YES if the class can understand data and NO otherwise.
*/
+ (BOOL)canInitWithData: (NSData *)data;

/** <init />
* Initilizes the reciever for output.
*/
- (id)initWithData: (NSData *)data;

/** Reads data provided in -initWithData:. Parameter bytes must be big enough
* to hold length bytes.
*/
- (NSUInteger)readBytes: (void *)bytes length: (NSUInteger)length;

/** Returns the duration, in seconds. Equivalent to [NSMovieView-duration].
*/
- (NSTimeInterval)duration;

/** Called by [NSSound-setCurrentTime:].
*/
- (void)setCurrentTime: (NSTimeInterval)currentTime;

/** Called by [NSSound-currentTime].
*/
- (NSTimeInterval)currentTime;

@end

#endif // _GNUstep_H_GSVideoSource
64 changes: 52 additions & 12 deletions Headers/AppKit/NSMovie.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
Author: Fred Kiefer <[email protected]>
Date: March 2003

Author: Gregory John Casamento <[email protected]>
Date: March 2022

This file is part of the GNUstep GUI Library.

This library is free software; you can redistribute it and/or
Expand All @@ -28,7 +31,11 @@

#ifndef _GNUstep_H_NSMovie
#define _GNUstep_H_NSMovie

#import <AppKit/AppKitDefines.h>
#import <GNUstepBase/GSVersionMacros.h>
#import <GNUstepGUI/GSVideoSource.h>
#import <GNUstepGUI/GSVideoSink.h>

#import <Foundation/NSObject.h>

Expand All @@ -41,20 +48,53 @@ APPKIT_EXPORT_CLASS
@interface NSMovie : NSObject <NSCopying, NSCoding>
{
@private
NSData* _movie;
NSURL* _url;
NSData *_movieData;
NSURL *_url;
void *_movie;
id< GSVideoSource > _source;
id< GSVideoSink > _sink;
}

+ (NSArray*) movieUnfilteredFileTypes;
+ (NSArray*) movieUnfilteredPasteboardTypes;
+ (BOOL) canInitWithPasteboard: (NSPasteboard*)pasteboard;

- (id) initWithMovie: (void*)movie;
- (id) initWithURL: (NSURL*)url byReference: (BOOL)byRef;
- (id) initWithPasteboard: (NSPasteboard*)pasteboard;

- (void*) QTMovie;
- (NSURL*) URL;
/**
* Returns the array of file types/extensions that NSMovie can handle
*/
+ (NSArray *) movieUnfilteredFileTypes;

/**
* Returns the array of pasteboard types that NSMovie can handle
*/
+ (NSArray *) movieUnfilteredPasteboardTypes;

/**
* Returns YES, if NSMovie can initialize with the data on the pasteboard
*/
+ (BOOL) canInitWithPasteboard: (NSPasteboard *)pasteboard;

/**
* Accepts a Carbon movie and uses it to init NSMovie (non-functional on GNUstep).
*/
- (id) initWithMovie: (void *)movie;

/**
* Retrieves the data from url and initializes with it, does so by references depending
* on byRef
*/
- (id) initWithURL: (NSURL *)url byReference: (BOOL)byRef;

/**
* Pulls the data from the pasteboard and initializes NSMovie.
*/
- (id) initWithPasteboard: (NSPasteboard *)pasteboard;

/**
* Return QTMovie
*/
- (void *) QTMovie;

/**
* The URL used to initialize NSMovie
*/
- (NSURL *) URL;

@end

Expand Down
Loading