Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

exteplayer3 - change png plugin init to lazy

  • Loading branch information...
e2iplayer committed May 5, 2019
1 parent 0f76468 commit 2d08f057f998b4e81f76f330fb180c4d47f246b5
Showing with 42 additions and 26 deletions.
  1. +4 −1 external/plugins/src/png.c
  2. +11 −11 include/output.h
  3. +17 −8 include/writer.h
  4. +1 −6 main/exteplayer.c
  5. +8 −0 output/graphic_subtitle.c
  6. +1 −0 output/output_subtitle.c
@@ -39,7 +39,9 @@ int PNGPlugin_saveRGBAImage(const char *filename, const unsigned char *data, int

int PNGPlugin_init(void)
{
if (NULL == handle)
if (NULL != handle)
return 0; /* Already initialized */
else
{
handle = dlopen("exteplayer3png.so", RTLD_LAZY);
if (handle)
@@ -60,6 +62,7 @@ int PNGPlugin_init(void)
}
plugin_err( "%s\n", dlerror());
}

return -1;
}

@@ -54,17 +54,17 @@ typedef struct

typedef struct
{
uint32_t trackId;
uint8_t *data;
uint32_t len;

uint8_t *extradata;
uint32_t extralen;

int64_t pts;
int64_t durationMS; // duration in miliseconds

char *type;
uint32_t trackId;
uint8_t *data;
uint32_t len;
uint8_t *extradata;
uint32_t extralen;
int64_t pts;
int64_t durationMS; // duration in miliseconds
char *type;
} SubtitleOut_t;


@@ -98,15 +98,24 @@ void FlushPipe(int pipefd);
ssize_t WriteExt(WriteV_t _call, int fd, void *data, size_t size);

// Subtitles

typedef enum {
SUBTITLE_CODEC_ID_SUBRIP,
SUBTITLE_CODEC_ID_ASS,
SUBTITLE_CODEC_ID_WEBVTT,
SUBTITLE_CODEC_ID_PGS
} SubtitleCodecId_t;

typedef struct {
uint32_t trackId;
uint8_t *data;
uint32_t len;
int64_t pts;
int64_t dts;
uint8_t *private_data;
uint32_t private_size;
int64_t durationMS; // duration in miliseconds
SubtitleCodecId_t codecId;
uint32_t trackId;
uint8_t *data;
uint32_t len;
int64_t pts;
int64_t dts;
uint8_t *private_data;
uint32_t private_size;
int64_t durationMS; // duration in miliseconds
} WriterSubCallData_t;

typedef struct SubWriter_s {
@@ -39,7 +39,6 @@

#include <pthread.h>

#include "plugins/png.h"
#include "common.h"
#include "misc.h"

@@ -629,7 +628,7 @@ int main(int argc, char* argv[])
int commandRetVal = -1;

/* inform client that we can handle additional commands */
E2iSendMsg("{\"EPLAYER3_EXTENDED\":{\"version\":%d}}\n", 63);
E2iSendMsg("{\"EPLAYER3_EXTENDED\":{\"version\":%d}}\n", 64);

PlayFiles_t playbackFiles;
memset(&playbackFiles, 0x00, sizeof(playbackFiles));
@@ -722,10 +721,6 @@ int main(int argc, char* argv[])

SetBuffering();

if (g_graphic_sub_path && g_graphic_sub_path[0] && g_windows_width > 0 && g_windows_height > 0)
if (PNGPlugin_init())
g_graphic_sub_path = NULL; // png plugin init failure

//Registrating output devices
g_player->output->Command(g_player, OUTPUT_ADD, "audio");
g_player->output->Command(g_player, OUTPUT_ADD, "video");
@@ -168,6 +168,14 @@ static int32_t Open(uint8_t *extradata, int extradata_size)
return -1;
}

/* Lazy PNG plugin init */
ret = PNGPlugin_init();
if (0 != ret)
{
/* Report plugin error */
E2iSendMsg("{\"e_plugin\":[\"png\",\"init\",%d]}\n", ret);
}

return 0;
}

@@ -236,6 +236,7 @@ static int Write(void *_context, void *data)

WriterSubCallData_t subPacket;
memset(&subPacket, 0x00, sizeof(subPacket));
subPacket.codecId = SUBTITLE_CODEC_ID_PGS;
subPacket.trackId = out->trackId;
subPacket.data = out->data;
subPacket.len = out->len;

0 comments on commit 2d08f05

Please sign in to comment.
You can’t perform that action at this time.