aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Input/in_flv/FLVReader.h
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/Input/in_flv/FLVReader.h
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/Plugins/Input/in_flv/FLVReader.h')
-rw-r--r--Src/Plugins/Input/in_flv/FLVReader.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/Src/Plugins/Input/in_flv/FLVReader.h b/Src/Plugins/Input/in_flv/FLVReader.h
new file mode 100644
index 00000000..27e68183
--- /dev/null
+++ b/Src/Plugins/Input/in_flv/FLVReader.h
@@ -0,0 +1,49 @@
+#ifndef NULLSOFT_IN_FLV_FLVREADER_H
+#define NULLSOFT_IN_FLV_FLVREADER_H
+
+#include <windows.h>
+#include <bfc/platform/types.h>
+#include "FLVStreamheader.h"
+#include "../nu/AutoLock.h"
+#include "BackgroundDownloader.h"
+#include "FLVProcessor.h"
+
+class FLVReader : private Downloader::DownloadCallback
+{
+public:
+ FLVReader(const wchar_t *_url);
+ ~FLVReader();
+
+ bool GetFrame(size_t frameIndex, FrameData &frameData);
+ bool GetPosition(int time_in_ms, size_t *frameIndex, bool needVideoKeyFrame);
+ uint64_t Seek(uint64_t position);
+ size_t Read(void *data, size_t bytes);
+ void Kill();
+ void SignalKill();
+ bool IsEOF();
+ uint32_t GetMaxTimestamp();
+ uint64_t GetProcessedPosition();
+ bool IsStreaming();
+ FLVHeader *GetHeader();
+private:
+ void ProcessFile();
+ int OnConnect(api_httpreceiver *http);
+ int OnData(void *data, size_t datalen);
+ int Process();
+ DWORD CALLBACK ParserThread();
+ static DWORD CALLBACK ParserThreadStub(LPVOID param) { return ((FLVReader *)param)->ParserThread(); }
+
+private:
+ bool killswitch;
+
+ HANDLE flvThread;
+ bool end_of_stream;
+ wchar_t *url;
+
+ /* because we won't know until after opening the stream whether it's progressive download
+ or a real-time stream, we need have a pointer to a virtual base class to do the processing
+ we'll create a different one depending on what kind of stream */
+ FLVProcessor *processor;
+};
+
+#endif \ No newline at end of file