mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 20:50:44 +00:00
Update so code builds properly
This commit is contained in:
parent
27a3d500f6
commit
0ba3345791
7 changed files with 1065 additions and 21 deletions
|
@ -49,6 +49,11 @@
|
|||
*/
|
||||
- (void) close;
|
||||
|
||||
/**
|
||||
* Play the entire video
|
||||
*/
|
||||
- (void) play;
|
||||
|
||||
/**
|
||||
* Plays the data in bytes
|
||||
*/
|
||||
|
@ -76,4 +81,3 @@
|
|||
@end
|
||||
|
||||
#endif // _GNUstep_H_GSVideoSink
|
||||
|
||||
|
|
|
@ -655,6 +655,8 @@ GSImageMagickImageRep.h \
|
|||
GSInstantiator.h \
|
||||
GSSoundSink.h \
|
||||
GSSoundSource.h \
|
||||
GSVideoSink.h \
|
||||
GSVideoSource.h \
|
||||
GSWindowDecorationView.h \
|
||||
GSXibElement.h \
|
||||
GSXibLoading.h \
|
||||
|
|
|
@ -68,6 +68,7 @@ enum
|
|||
@implementation NSMovieView (PrivateMethods)
|
||||
- (void) _stream
|
||||
{
|
||||
/*
|
||||
NSUInteger bytesRead;
|
||||
BOOL success = NO;
|
||||
void *buffer;
|
||||
|
@ -110,6 +111,9 @@ enum
|
|||
withObject: [NSNumber numberWithBool: success]
|
||||
waitUntilDone: YES];
|
||||
RELEASE(self);
|
||||
*/
|
||||
[[_movie _sink] play];
|
||||
// video_main(_movie, self);
|
||||
}
|
||||
|
||||
- (void) _finished: (NSNumber *)finishedPlaying
|
||||
|
@ -159,7 +163,7 @@ enum
|
|||
- (void) start: (id)sender
|
||||
{
|
||||
/*
|
||||
// If the locks exists this instance is already playing
|
||||
// If the locks exists this instance is already playing
|
||||
if (_readLock != nil && _playbackLock != nil)
|
||||
{
|
||||
return;
|
||||
|
@ -172,13 +176,14 @@ enum
|
|||
{
|
||||
return;
|
||||
}
|
||||
|
||||
*/
|
||||
_shouldStop = NO;
|
||||
[NSThread detachNewThreadSelector: @selector(_stream)
|
||||
toTarget: self
|
||||
withObject: nil];
|
||||
|
||||
[_readLock unlockWithCondition: MOVIE_SHOULD_PLAY];
|
||||
// [_readLock unlockWithCondition: MOVIE_SHOULD_PLAY];
|
||||
|
||||
}
|
||||
|
||||
- (void) stop: (id)sender
|
||||
|
@ -196,7 +201,6 @@ enum
|
|||
|
||||
// Set to MOVIE_SHOULD_PLAY so that thread isn't blocked.
|
||||
[_readLock unlockWithCondition: MOVIE_SHOULD_PLAY];
|
||||
*/
|
||||
}
|
||||
|
||||
- (BOOL) isPlaying
|
||||
|
|
|
@ -21,6 +21,7 @@ VideoOutput_LIB_DIRS += \
|
|||
# Build the bundles.
|
||||
VideoFile_OBJC_FILES = VideoFileSource.m
|
||||
VideoOutput_OBJC_FILES = VideoOutputSink.m ffplay.m
|
||||
VideoOutlet_C_FILES = cmdutils.c
|
||||
|
||||
VideoFile_PRINCIPAL_CLASS = VideoFileSource
|
||||
VideoOutput_PRINCIPAL_CLASS = VidioOutputSink
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
AudioOutputSink.m
|
||||
/*
|
||||
VideoOutputSink.m
|
||||
|
||||
Sink audio data to libavcodec.
|
||||
Sink video data to libavcodec.
|
||||
|
||||
Copyright (C) 2022 Free Software Foundation, Inc.
|
||||
|
||||
|
@ -58,18 +58,28 @@
|
|||
*/
|
||||
|
||||
#include <libavcodec/avcodec.h>
|
||||
#include "cmdutils.h"
|
||||
|
||||
#define INBUF_SIZE 4096
|
||||
|
||||
/*
|
||||
AVDictionary *codec_opts;
|
||||
AVDictionary *format_opts;
|
||||
AVDictionary *swr_opts;
|
||||
AVDictionary *sws_dict;
|
||||
*/
|
||||
|
||||
int video_main(NSMovie *movie, NSMovieView *view);
|
||||
|
||||
@interface VideoOutputSink : NSObject <GSVideoSink>
|
||||
{
|
||||
/*
|
||||
AVCodec *_codec;
|
||||
AVCodecParserContext *_parser;
|
||||
AVCodecContext *_context; // = NULL;
|
||||
AVPacket *_pkt;
|
||||
AVFrame *_frame;
|
||||
*/
|
||||
|
||||
NSMovieView *_movieView;
|
||||
}
|
||||
|
@ -97,13 +107,14 @@ int video_main(NSMovie *movie, NSMovieView *view);
|
|||
fwrite(buf + i * wrap, 1, xsize, f);
|
||||
fclose(f);
|
||||
*/
|
||||
NSLog(@"Playing...");
|
||||
NSLog(@"Playing... %d, %d, %d", wrap, xsize, ysize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (void) decode
|
||||
{
|
||||
/*
|
||||
int ret;
|
||||
|
||||
ret = avcodec_send_packet(_context, _pkt);
|
||||
|
@ -129,8 +140,8 @@ int video_main(NSMovie *movie, NSMovieView *view);
|
|||
NSLog(@"saving frame %3d\n", _context->frame_number);
|
||||
fflush(stdout);
|
||||
|
||||
/* the picture is allocated by the decoder. no need to
|
||||
free it */
|
||||
// the picture is allocated by the decoder. no need to
|
||||
// free it
|
||||
// snprintf(buf, sizeof(buf), "%d", _context->frame_number);
|
||||
[self display: _frame->data[0]
|
||||
wrap: _frame->linesize[0]
|
||||
|
@ -140,16 +151,17 @@ int video_main(NSMovie *movie, NSMovieView *view);
|
|||
// pgm_save(frame->data[0], frame->linesize[0],
|
||||
// frame->width, frame->height, buf);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[self close];
|
||||
_movieView = nil;
|
||||
_pkt = NULL;
|
||||
_context = NULL;
|
||||
_parser = NULL;
|
||||
_frame = NULL;
|
||||
//_pkt = NULL;
|
||||
//_context = NULL;
|
||||
//_parser = NULL;
|
||||
//_frame = NULL;
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
|
@ -161,10 +173,10 @@ int video_main(NSMovie *movie, NSMovieView *view);
|
|||
if (self != nil)
|
||||
{
|
||||
_movieView = nil;
|
||||
_pkt = NULL;
|
||||
_context = NULL;
|
||||
_parser = NULL;
|
||||
_frame = NULL;
|
||||
// _pkt = NULL;
|
||||
//_context = NULL;
|
||||
//_parser = NULL;
|
||||
//_frame = NULL;
|
||||
}
|
||||
|
||||
return self;
|
||||
|
@ -182,6 +194,7 @@ int video_main(NSMovie *movie, NSMovieView *view);
|
|||
|
||||
- (BOOL)open
|
||||
{
|
||||
/*
|
||||
_pkt = av_packet_alloc();
|
||||
if (!_pkt)
|
||||
{
|
||||
|
@ -210,7 +223,6 @@ int video_main(NSMovie *movie, NSMovieView *view);
|
|||
return NO;
|
||||
}
|
||||
|
||||
/* open it */
|
||||
if (avcodec_open2(_context, _codec, NULL) < 0)
|
||||
{
|
||||
NSLog(@"Could not open codec\n");
|
||||
|
@ -225,10 +237,13 @@ int video_main(NSMovie *movie, NSMovieView *view);
|
|||
}
|
||||
|
||||
return YES;
|
||||
*/
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)close
|
||||
{
|
||||
/*
|
||||
if (_parser != NULL)
|
||||
{
|
||||
av_parser_close(_parser);
|
||||
|
@ -248,15 +263,17 @@ int video_main(NSMovie *movie, NSMovieView *view);
|
|||
{
|
||||
av_packet_free(&_pkt);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
- (void) play
|
||||
{
|
||||
|
||||
video_main([_movieView movie], _movieView);
|
||||
}
|
||||
|
||||
- (BOOL)playBytes: (void *)bytes length: (NSUInteger)length
|
||||
{
|
||||
/*
|
||||
int ret = av_parser_parse2(_parser, _context, &_pkt->data, &_pkt->size,
|
||||
bytes, length, AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0);
|
||||
if (ret < 0)
|
||||
|
@ -284,6 +301,8 @@ int video_main(NSMovie *movie, NSMovieView *view);
|
|||
}
|
||||
|
||||
return YES;
|
||||
*/
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)setVolume: (float)volume
|
||||
|
|
1012
Tools/video/cmdutils.c
Normal file
1012
Tools/video/cmdutils.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -3700,6 +3700,8 @@ int video_main(NSMovie *movie, NSMovieView *view) //(int argc, char **argv)
|
|||
int flags;
|
||||
VideoState *is;
|
||||
|
||||
NSLog(@"video_main called %@, %@", movie, view);
|
||||
|
||||
init_dynload();
|
||||
|
||||
av_log_set_flags(AV_LOG_SKIP_REPEATED);
|
||||
|
|
Loading…
Reference in a new issue