diff options
author | Jean-Francois Mauguit <jfmauguit@mac.com> | 2024-09-24 09:03:25 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-24 09:03:25 -0400 |
commit | bab614c421ed7ae329d26bf028c4a3b1d2450f5a (patch) | |
tree | 12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Winamp/vid_subs.h | |
parent | 4bde6044fddf053f31795b9eaccdd2a5a527d21f (diff) | |
parent | 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (diff) | |
download | winamp-bab614c421ed7ae329d26bf028c4a3b1d2450f5a.tar.gz |
Merge pull request #5 from WinampDesktop/community
Merge to main
Diffstat (limited to 'Src/Winamp/vid_subs.h')
-rw-r--r-- | Src/Winamp/vid_subs.h | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/Src/Winamp/vid_subs.h b/Src/Winamp/vid_subs.h new file mode 100644 index 00000000..b467696d --- /dev/null +++ b/Src/Winamp/vid_subs.h @@ -0,0 +1,75 @@ +#ifndef NSVPLAY_SUBTITLES_H +#define NSVPLAY_SUBTITLES_H + +#include "wa_ipc.h" +//#include "main.h" +//#include "../nsvbs.h" + +typedef struct +{ + const char *language; + const char *utf8_text; + unsigned int start_frame, end_frame; + unsigned char xPos, yPos; + unsigned char colorRed, colorGreen, colorBlue; + signed char fontSize; + int extraDataSize; + const void *extraData; +} SUBTITLE_INFO; + +class SubsItem { +public: + SubsItem(unsigned int ptimestart, unsigned int ptimeend, const char *ptext) : + timestart(ptimestart) , timeend(ptimeend) { + text=_strdup(ptext); + xPos=128; + yPos=255; + colorRed=colorGreen=colorBlue=0xff; + extraDataSize=0; + extraData=0; + muxed_subtitle=0; + fontSize=origFontSize=0; + } + ~SubsItem() { + free((void*)text); + if(extraDataSize) free((void *)extraData); + } + + unsigned int timestart; + unsigned int timeend; + const char *text; + + unsigned char xPos, yPos; + unsigned char colorRed, colorGreen, colorBlue; + int extraDataSize; + const void *extraData; + + int muxed_subtitle; //so we free it when we seek/display + + int fontSize; + + int origFontSize; +}; + +class Subtitles { +public: + Subtitles(const char *filename); + + SubsItem *getSubtitle(unsigned int time, unsigned int frame); // time in ms + void addSubtitlePacket(SUBTITLE_INFO *sti); + + void setFontSizeModifier(int size) { m_font_size_mod=size; } + +private: + void decodeSrtFile(char *text); + unsigned int getTimeFromSrtText(const char *text); + + void decodeSubFile(char *text); + + //ClassList<SubsItem> m_subs; //FUCKO + int m_frame_based; + int m_last_sub; + int m_font_size_mod; +}; + +#endif
\ No newline at end of file |