Cocoa Port: Be a lot cleaner about commenting out non-working code.
This commit is contained in:
parent
ab38d17fea
commit
725ffb5127
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (C) 2018 DeSmuME team
|
||||
Copyright (C) 2018-2022 DeSmuME team
|
||||
|
||||
This file is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
|
@ -90,9 +90,10 @@ static AVFrame *get_video_frame(OutputStream *ost)
|
|||
|
||||
return ost->frame;
|
||||
}
|
||||
|
||||
*/
|
||||
FFmpegFileStream::FFmpegFileStream()
|
||||
{
|
||||
/*
|
||||
memset(&_videoStream, 0, sizeof(OutputStream));
|
||||
memset(&_audioStream, 0, sizeof(OutputStream));
|
||||
|
||||
|
@ -100,13 +101,14 @@ FFmpegFileStream::FFmpegFileStream()
|
|||
_outputCtx = NULL;
|
||||
_audioCodec = NULL;
|
||||
_videoCodec = NULL;
|
||||
*/
|
||||
}
|
||||
|
||||
FFmpegFileStream::~FFmpegFileStream()
|
||||
{
|
||||
this->Close(FSCA_WriteRemainingInQueue);
|
||||
}
|
||||
|
||||
/*
|
||||
AVFrame* FFmpegFileStream::_InitVideoFrame(const int pixFormat, const int videoWidth, const int videoHeight)
|
||||
{
|
||||
AVFrame *theFrame = av_frame_alloc();
|
||||
|
@ -176,9 +178,10 @@ void FFmpegFileStream::_CloseStream(OutputStream *outStream)
|
|||
swr_free(&outStream->swr_ctx);
|
||||
outStream->swr_ctx = NULL;
|
||||
}
|
||||
|
||||
*/
|
||||
void FFmpegFileStream::_CloseStreams()
|
||||
{
|
||||
/*
|
||||
// Write the trailer, if any. The trailer must be written before you
|
||||
// close the CodecContexts open when you wrote the header; otherwise
|
||||
// av_write_trailer() may try to use memory that was freed on
|
||||
|
@ -195,11 +198,13 @@ void FFmpegFileStream::_CloseStreams()
|
|||
{
|
||||
this->_CloseStream(&this->_audioStream);
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
ClientAVCaptureError FFmpegFileStream::_SendStreamFrame(OutputStream *outStream)
|
||||
{
|
||||
ClientAVCaptureError error = ClientAVCaptureError_None;
|
||||
/*
|
||||
bool gotValidPacket = false;
|
||||
|
||||
int result = 0;
|
||||
|
@ -245,12 +250,13 @@ ClientAVCaptureError FFmpegFileStream::_SendStreamFrame(OutputStream *outStream)
|
|||
av_free(thePacket.data);
|
||||
av_packet_unref(&thePacket);
|
||||
}
|
||||
|
||||
*/
|
||||
return error;
|
||||
}
|
||||
|
||||
void FFmpegFileStream::_LogPacket(const AVPacket *thePacket)
|
||||
{
|
||||
/*
|
||||
AVRational *time_base = &this->_outputCtx->streams[thePacket->stream_index]->time_base;
|
||||
|
||||
printf("pts:%s pts_time:%s dts:%s dts_time:%s duration:%s duration_time:%s stream_index:%d\n",
|
||||
|
@ -258,11 +264,13 @@ void FFmpegFileStream::_LogPacket(const AVPacket *thePacket)
|
|||
av_ts2str(thePacket->dts), av_ts2timestr(thePacket->dts, time_base),
|
||||
av_ts2str(thePacket->duration), av_ts2timestr(thePacket->duration, time_base),
|
||||
thePacket->stream_index);
|
||||
*/
|
||||
}
|
||||
|
||||
ClientAVCaptureError FFmpegFileStream::Open()
|
||||
{
|
||||
ClientAVCaptureError error = ClientAVCaptureError_None;
|
||||
/*
|
||||
int result = 0;
|
||||
AVDictionary *containerOptions = NULL;
|
||||
AVDictionary *videoOptions = NULL;
|
||||
|
@ -758,7 +766,7 @@ ClientAVCaptureError FFmpegFileStream::Open()
|
|||
error = ClientAVCaptureError_FileOpenError;
|
||||
return error;
|
||||
}
|
||||
|
||||
*/
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -814,8 +822,8 @@ void FFmpegFileStream::Close(FileStreamCloseAction theAction)
|
|||
ssem_signal(this->_semQueue);
|
||||
|
||||
} while (true);
|
||||
*
|
||||
|
||||
*/
|
||||
/*
|
||||
AVPacket thePacket = { 0 };
|
||||
int result = 0;
|
||||
|
||||
|
@ -878,6 +886,7 @@ void FFmpegFileStream::Close(FileStreamCloseAction theAction)
|
|||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -888,7 +897,7 @@ void FFmpegFileStream::Close(FileStreamCloseAction theAction)
|
|||
}
|
||||
|
||||
this->_CloseStreams();
|
||||
|
||||
/*
|
||||
// Close the output file.
|
||||
if (!(this->_outputFormat->flags & AVFMT_NOFILE))
|
||||
{
|
||||
|
@ -898,19 +907,20 @@ void FFmpegFileStream::Close(FileStreamCloseAction theAction)
|
|||
// free the stream
|
||||
avformat_free_context(this->_outputCtx);
|
||||
this->_outputCtx = NULL;
|
||||
|
||||
*/
|
||||
printf("AV recording complete.\n");
|
||||
}
|
||||
|
||||
bool FFmpegFileStream::IsValid()
|
||||
{
|
||||
return (this->_outputCtx != NULL);
|
||||
//return (this->_outputCtx != NULL);
|
||||
return false;
|
||||
}
|
||||
|
||||
ClientAVCaptureError FFmpegFileStream::FlushVideo(uint8_t *srcBuffer, const size_t bufferSize)
|
||||
{
|
||||
ClientAVCaptureError error = ClientAVCaptureError_None;
|
||||
|
||||
/*
|
||||
int result = 0;
|
||||
AVCodecContext *codecCtx = this->_videoStream.enc;
|
||||
|
||||
|
@ -942,14 +952,14 @@ ClientAVCaptureError FFmpegFileStream::FlushVideo(uint8_t *srcBuffer, const size
|
|||
{
|
||||
return error;
|
||||
}
|
||||
|
||||
*/
|
||||
return error;
|
||||
}
|
||||
|
||||
ClientAVCaptureError FFmpegFileStream::FlushAudio(uint8_t *srcBuffer, const size_t bufferSize)
|
||||
{
|
||||
ClientAVCaptureError error = ClientAVCaptureError_None;
|
||||
|
||||
/*
|
||||
int result = 0;
|
||||
AVCodecContext *codecCtx = this->_audioStream.enc;
|
||||
const size_t sampleSize = sizeof(int16_t) * 2;
|
||||
|
@ -1035,7 +1045,7 @@ ClientAVCaptureError FFmpegFileStream::FlushAudio(uint8_t *srcBuffer, const size
|
|||
this->_audioStream.inBufferOffset = 0;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -1061,13 +1071,13 @@ ClientAVCaptureError FFmpegFileStream::WriteOneFrame(const AVStreamWriteParam &p
|
|||
const size_t futureFrameSize = this->_writtenBytes + this->_expectedMaxFrameSize;
|
||||
if (futureFrameSize >= this->_maxSegmentSize)
|
||||
{
|
||||
AVFormatContext *oldContext = this->_outputCtx;
|
||||
//AVFormatContext *oldContext = this->_outputCtx;
|
||||
|
||||
this->_CloseStreams();
|
||||
this->_segmentNumber++;
|
||||
|
||||
error = this->Open();
|
||||
|
||||
/*
|
||||
// Close the output file.
|
||||
if (!(oldContext->flags & AVFMT_NOFILE))
|
||||
{
|
||||
|
@ -1075,7 +1085,7 @@ ClientAVCaptureError FFmpegFileStream::WriteOneFrame(const AVStreamWriteParam &p
|
|||
}
|
||||
|
||||
avformat_free_context(oldContext);
|
||||
|
||||
*/
|
||||
if (error)
|
||||
{
|
||||
puts("Error creating new AVI segment.");
|
||||
|
@ -1086,7 +1096,7 @@ ClientAVCaptureError FFmpegFileStream::WriteOneFrame(const AVStreamWriteParam &p
|
|||
|
||||
return error;
|
||||
}
|
||||
*/
|
||||
|
||||
@implementation MacAVCaptureToolDelegate
|
||||
|
||||
@synthesize recordButton;
|
||||
|
@ -1384,7 +1394,6 @@ ClientAVCaptureError FFmpegFileStream::WriteOneFrame(const AVStreamWriteParam &p
|
|||
std::string fileName = param.savePath + "/" + std::string([fileNameNSString cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
|
||||
// Create the output file stream.
|
||||
/*
|
||||
ClientAVCaptureError error = ClientAVCaptureError_None;
|
||||
FFmpegFileStream *ffmpegFS = new FFmpegFileStream;
|
||||
|
||||
|
@ -1410,7 +1419,6 @@ ClientAVCaptureError FFmpegFileStream::WriteOneFrame(const AVStreamWriteParam &p
|
|||
|
||||
_videoCaptureOutput = newVideoCaptureObject;
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
- (void) closeFileStream
|
||||
|
@ -1470,7 +1478,6 @@ static void* RunAVCaptureCloseThread(void *arg)
|
|||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
ClientAVCaptureObject *captureObject = (ClientAVCaptureObject *)arg;
|
||||
FFmpegFileStream *ffmpegFS = (FFmpegFileStream *)captureObject->GetOutputFileStream();
|
||||
|
||||
|
@ -1480,6 +1487,6 @@ static void* RunAVCaptureCloseThread(void *arg)
|
|||
delete captureObject;
|
||||
|
||||
[[NSNotificationCenter defaultCenter] postNotificationOnMainThreadName:@"org.desmume.DeSmuME.avFileStreamCloseFinish" object:nil userInfo:nil];
|
||||
*/
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue