mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
libeplayer3: drop non-shared framebuffer support
This commit is contained in:
@@ -18,9 +18,9 @@ class cPlayback
|
|||||||
int mSubtitleStream;
|
int mSubtitleStream;
|
||||||
int mDvbsubtitleStream;
|
int mDvbsubtitleStream;
|
||||||
int mTeletextStream;
|
int mTeletextStream;
|
||||||
void (*framebuffer_callback)(uint32_t **, unsigned int *, unsigned int *, unsigned int *, int *, void (**)(void));
|
void (*framebuffer_callback)(uint32_t **, unsigned int *, unsigned int *, unsigned int *, void (**)(void));
|
||||||
public:
|
public:
|
||||||
cPlayback(int, void (*)(uint32_t **, unsigned int *, unsigned int *, unsigned int *, int *, void (**)(void)) = NULL) { };
|
cPlayback(int, void (*)(uint32_t **, unsigned int *, unsigned int *, unsigned int *, void (**)(void)) = NULL) { };
|
||||||
bool Open(playmode_t PlayMode);
|
bool Open(playmode_t PlayMode);
|
||||||
void Close(void);
|
void Close(void);
|
||||||
bool Start(char * filename, unsigned short vpid, int vtype, unsigned short apid, bool ac3, int duration, bool no_probe = true);
|
bool Start(char * filename, unsigned short vpid, int vtype, unsigned short apid, bool ac3, int duration, bool no_probe = true);
|
||||||
|
@@ -122,8 +122,6 @@ static ASS_Renderer *ass_renderer;
|
|||||||
|
|
||||||
static unsigned int screen_width = 0;
|
static unsigned int screen_width = 0;
|
||||||
static unsigned int screen_height = 0;
|
static unsigned int screen_height = 0;
|
||||||
static int shareFramebuffer = 0;
|
|
||||||
static int framebufferFD = -1;
|
|
||||||
static uint32_t *destination = NULL;
|
static uint32_t *destination = NULL;
|
||||||
static int destStride = 0;
|
static int destStride = 0;
|
||||||
static void (*framebufferBlit)(void) = NULL;
|
static void (*framebufferBlit)(void) = NULL;
|
||||||
@@ -202,7 +200,6 @@ void releaseRegions()
|
|||||||
ass_printf(100, "release: w %d h %d x %d y %d\n",
|
ass_printf(100, "release: w %d h %d x %d y %d\n",
|
||||||
next->w, next->h, next->x, next->y);
|
next->w, next->h, next->x, next->y);
|
||||||
|
|
||||||
out.fd = framebufferFD;
|
|
||||||
out.data = NULL;
|
out.data = NULL;
|
||||||
out.Width = next->w;
|
out.Width = next->w;
|
||||||
out.Height = next->h;
|
out.Height = next->h;
|
||||||
@@ -261,7 +258,6 @@ void checkRegions()
|
|||||||
ass_printf(100, "release: w %d h %d x %d y %d\n",
|
ass_printf(100, "release: w %d h %d x %d y %d\n",
|
||||||
next->w, next->h, next->x, next->y);
|
next->w, next->h, next->x, next->y);
|
||||||
|
|
||||||
out.fd = framebufferFD;
|
|
||||||
out.data = NULL;
|
out.data = NULL;
|
||||||
out.Width = next->w;
|
out.Width = next->w;
|
||||||
out.Height = next->h;
|
out.Height = next->h;
|
||||||
@@ -399,53 +395,42 @@ static void ASSThread(Context_t *context) {
|
|||||||
if (ass_track && ass_track->events)
|
if (ass_track && ass_track->events)
|
||||||
undisplay = now + (ass_track->events->Duration + 500) / 90000;
|
undisplay = now + (ass_track->events->Duration + 500) / 90000;
|
||||||
|
|
||||||
if (shareFramebuffer) {
|
ASS_Image *it;
|
||||||
ASS_Image *it;
|
int x0 = screen_width - 1;
|
||||||
int x0 = screen_width - 1;
|
int y0 = screen_height - 1;
|
||||||
int y0 = screen_height - 1;
|
int x1 = 0;
|
||||||
int x1 = 0;
|
int y1 = 0;
|
||||||
int y1 = 0;
|
for (it = img; it; it = it->next) {
|
||||||
for (it = img; it; it = it->next) {
|
if (it->w && it->h) {
|
||||||
if (it->w && it->h) {
|
if (it->dst_x < x0)
|
||||||
if (it->dst_x < x0)
|
x0 = it->dst_x;
|
||||||
x0 = it->dst_x;
|
if (it->dst_y < y0)
|
||||||
if (it->dst_y < y0)
|
y0 = it->dst_y;
|
||||||
y0 = it->dst_y;
|
if (it->dst_x + it->w > x1)
|
||||||
if (it->dst_x + it->w > x1)
|
x1 = it->dst_x + it->w;
|
||||||
x1 = it->dst_x + it->w;
|
if (it->dst_y + it->h > y1)
|
||||||
if (it->dst_y + it->h > y1)
|
y1 = it->dst_y + it->h;
|
||||||
y1 = it->dst_y + it->h;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (x1 > 0 && y1 > 0)
|
}
|
||||||
{
|
if (x1 > 0 && y1 > 0)
|
||||||
x1++;
|
{
|
||||||
y1++;
|
x1++;
|
||||||
int x, y;
|
y1++;
|
||||||
uint32_t *dst = destination + y0 * destStride/sizeof(uint32_t) + x0;
|
int x, y;
|
||||||
int destStrideDiff = destStride/sizeof(uint32_t) - (x1 - x0);
|
uint32_t *dst = destination + y0 * destStride/sizeof(uint32_t) + x0;
|
||||||
for (y = y0; y < y1; y++) {
|
int destStrideDiff = destStride/sizeof(uint32_t) - (x1 - x0);
|
||||||
for (x = x0; x < x1; x++)
|
for (y = y0; y < y1; y++) {
|
||||||
*dst++ = 0x80808080;
|
for (x = x0; x < x1; x++)
|
||||||
dst += destStrideDiff;
|
*dst++ = 0x80808080;
|
||||||
}
|
dst += destStrideDiff;
|
||||||
storeRegion(x0, y0, x1 - x0, y1 - y0, undisplay);
|
|
||||||
needsBlit = 1;
|
|
||||||
}
|
}
|
||||||
|
storeRegion(x0, y0, x1 - x0, y1 - y0, undisplay);
|
||||||
|
needsBlit = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (context && context->playback && context->playback->isPlaying && img)
|
while (context && context->playback && context->playback->isPlaying && img)
|
||||||
{
|
{
|
||||||
WriterFBCallData_t out;
|
WriterFBCallData_t out;
|
||||||
#if 0
|
|
||||||
time_t now = time(NULL);
|
|
||||||
time_t undisplay = now + 10;
|
|
||||||
|
|
||||||
if (ass_track && ass_track->events)
|
|
||||||
{
|
|
||||||
undisplay = now + (ass_track->events->Duration + 500) / 90000;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
ass_printf(100, "w %d h %d s %d x %d y %d c %d chg %d now %ld und %ld\n",
|
ass_printf(100, "w %d h %d s %d x %d y %d c %d chg %d now %ld und %ld\n",
|
||||||
img->w, img->h, img->stride,
|
img->w, img->h, img->stride,
|
||||||
@@ -457,7 +442,6 @@ static void ASSThread(Context_t *context) {
|
|||||||
*/
|
*/
|
||||||
if ((img->w != 0) && (img->h != 0) && writer)
|
if ((img->w != 0) && (img->h != 0) && writer)
|
||||||
{
|
{
|
||||||
out.fd = framebufferFD;
|
|
||||||
out.data = img->bitmap;
|
out.data = img->bitmap;
|
||||||
out.Width = img->w;
|
out.Width = img->w;
|
||||||
out.Height = img->h;
|
out.Height = img->h;
|
||||||
@@ -471,50 +455,9 @@ static void ASSThread(Context_t *context) {
|
|||||||
out.destination = destination;
|
out.destination = destination;
|
||||||
out.destStride = destStride;
|
out.destStride = destStride;
|
||||||
|
|
||||||
#if 0
|
if(context && context->playback && context->playback->isPlaying && writer)
|
||||||
storeRegion(img->dst_x, img->dst_y,
|
writer->writeData(&out);
|
||||||
img->w, img->h, undisplay);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (shareFramebuffer)
|
|
||||||
{
|
|
||||||
if(context && context->playback && context->playback->isPlaying && writer){
|
|
||||||
writer->writeData(&out);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#if NO_SHARED_FRAMEBUFFER
|
|
||||||
// currently not needed, but might be useful when switching to cst subtitle implementation in movieplayer
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* application does not want to share framebuffer,
|
|
||||||
* so there is hopefully installed an output callback
|
|
||||||
* in the subtitle output!
|
|
||||||
*/
|
|
||||||
SubtitleOut_t sub_out;
|
|
||||||
|
|
||||||
sub_out.type = eSub_Gfx;
|
|
||||||
|
|
||||||
if (ass_track->events)
|
|
||||||
{
|
|
||||||
/* fixme: check values */
|
|
||||||
sub_out.pts = ass_track->events->Start * 90.0;
|
|
||||||
sub_out.duration = ass_track->events->Duration / 1000.0;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
sub_out.pts = playPts;
|
|
||||||
sub_out.duration = 10.0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub_out.u.gfx.data = img->bitmap;
|
|
||||||
sub_out.u.gfx.Width = img->w;
|
|
||||||
sub_out.u.gfx.Height = img->h;
|
|
||||||
sub_out.u.gfx.x = img->dst_x;
|
|
||||||
sub_out.u.gfx.y = img->dst_y;
|
|
||||||
if(context && context->playback && context->playback->isPlaying &&
|
|
||||||
context->output && context->output->subtitle)
|
|
||||||
context->output->subtitle->Write(context, &sub_out);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
needsBlit = 1;
|
needsBlit = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -587,14 +530,11 @@ int container_ass_init(Context_t *context)
|
|||||||
|
|
||||||
screen_width = output.screen_width;
|
screen_width = output.screen_width;
|
||||||
screen_height = output.screen_height;
|
screen_height = output.screen_height;
|
||||||
shareFramebuffer = output.shareFramebuffer;
|
|
||||||
framebufferFD = output.framebufferFD;
|
|
||||||
destination = output.destination;
|
destination = output.destination;
|
||||||
destStride = output.destStride;
|
destStride = output.destStride;
|
||||||
framebufferBlit = output.framebufferBlit;
|
framebufferBlit = output.framebufferBlit;
|
||||||
|
|
||||||
ass_printf(10, "width %d, height %d, share %d, fd %d\n",
|
ass_printf(10, "width %d, height %d\n", screen_width, screen_height);
|
||||||
screen_width, screen_height, shareFramebuffer, framebufferFD);
|
|
||||||
|
|
||||||
ass_set_frame_size(ass_renderer, screen_width, screen_height);
|
ass_set_frame_size(ass_renderer, screen_width, screen_height);
|
||||||
ass_set_margins(ass_renderer, (int)(0.03 * screen_height), (int)(0.03 * screen_height) ,
|
ass_set_margins(ass_renderer, (int)(0.03 * screen_height), (int)(0.03 * screen_height) ,
|
||||||
|
@@ -119,8 +119,6 @@ typedef struct
|
|||||||
unsigned int screen_height;
|
unsigned int screen_height;
|
||||||
unsigned int destStride;
|
unsigned int destStride;
|
||||||
|
|
||||||
int shareFramebuffer;
|
|
||||||
int framebufferFD;
|
|
||||||
void (*framebufferBlit)(void);
|
void (*framebufferBlit)(void);
|
||||||
} SubtitleOutputDef_t;
|
} SubtitleOutputDef_t;
|
||||||
|
|
||||||
|
@@ -106,8 +106,6 @@ static int isSubtitleOpened = 0;
|
|||||||
static int screen_width = 0;
|
static int screen_width = 0;
|
||||||
static int screen_height = 0;
|
static int screen_height = 0;
|
||||||
static int destStride = 0;
|
static int destStride = 0;
|
||||||
static int shareFramebuffer = 0;
|
|
||||||
static int framebufferFD = -1;
|
|
||||||
static void (*framebufferBlit) = NULL;
|
static void (*framebufferBlit) = NULL;
|
||||||
static uint32_t *destination = NULL;
|
static uint32_t *destination = NULL;
|
||||||
|
|
||||||
@@ -781,8 +779,6 @@ static int Command(void *_context, OutputCmd_t command, void * argument) {
|
|||||||
SubtitleOutputDef_t* out = (SubtitleOutputDef_t*)argument;
|
SubtitleOutputDef_t* out = (SubtitleOutputDef_t*)argument;
|
||||||
out->screen_width = screen_width;
|
out->screen_width = screen_width;
|
||||||
out->screen_height = screen_height;
|
out->screen_height = screen_height;
|
||||||
out->shareFramebuffer = shareFramebuffer;
|
|
||||||
out->framebufferFD = framebufferFD;
|
|
||||||
out->framebufferBlit = framebufferBlit;
|
out->framebufferBlit = framebufferBlit;
|
||||||
out->destination = destination;
|
out->destination = destination;
|
||||||
out->destStride = destStride;
|
out->destStride = destStride;
|
||||||
@@ -792,8 +788,6 @@ static int Command(void *_context, OutputCmd_t command, void * argument) {
|
|||||||
SubtitleOutputDef_t* out = (SubtitleOutputDef_t*)argument;
|
SubtitleOutputDef_t* out = (SubtitleOutputDef_t*)argument;
|
||||||
screen_width = out->screen_width;
|
screen_width = out->screen_width;
|
||||||
screen_height = out->screen_height;
|
screen_height = out->screen_height;
|
||||||
shareFramebuffer = out->shareFramebuffer;
|
|
||||||
framebufferFD = out->framebufferFD;
|
|
||||||
framebufferBlit = out->framebufferBlit;
|
framebufferBlit = out->framebufferBlit;
|
||||||
destination = out->destination;
|
destination = out->destination;
|
||||||
destStride = out->destStride;
|
destStride = out->destStride;
|
||||||
|
@@ -169,10 +169,8 @@ int main(int argc,char* argv[]) {
|
|||||||
/* for testing ass subtitles */
|
/* for testing ass subtitles */
|
||||||
out.screen_width = xRes;
|
out.screen_width = xRes;
|
||||||
out.screen_height = yRes;
|
out.screen_height = yRes;
|
||||||
out.framebufferFD = fd;
|
|
||||||
out.destination = (uint32_t *)lfb;
|
out.destination = (uint32_t *)lfb;
|
||||||
out.destStride = stride;
|
out.destStride = stride;
|
||||||
out.shareFramebuffer = 1;
|
|
||||||
|
|
||||||
player->output->subtitle->Command(player, (OutputCmd_t)OUTPUT_SET_SUBTITLE_OUTPUT, (void*) &out);
|
player->output->subtitle->Command(player, (OutputCmd_t)OUTPUT_SET_SUBTITLE_OUTPUT, (void*) &out);
|
||||||
|
|
||||||
|
@@ -73,8 +73,7 @@ bool cPlayback::Open(playmode_t PlayMode)
|
|||||||
if (framebuffer_callback) {
|
if (framebuffer_callback) {
|
||||||
SubtitleOutputDef_t so;
|
SubtitleOutputDef_t so;
|
||||||
memset(&so, 0, sizeof(so));
|
memset(&so, 0, sizeof(so));
|
||||||
framebuffer_callback(&so.destination, &so.screen_width, &so.screen_height, &so.destStride, &so.framebufferFD, &so.framebufferBlit);
|
framebuffer_callback(&so.destination, &so.screen_width, &so.screen_height, &so.destStride, &so.framebufferBlit);
|
||||||
so.shareFramebuffer = 1;
|
|
||||||
player->output->subtitle->Command(player, OUTPUT_SET_SUBTITLE_OUTPUT, (void*)&so);
|
player->output->subtitle->Command(player, OUTPUT_SET_SUBTITLE_OUTPUT, (void*)&so);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -707,7 +706,7 @@ void cPlayback::GetChapters(std::vector<int> &positions, std::vector<std::string
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
cPlayback::cPlayback(int num __attribute__((unused)), void (*fbcb)(uint32_t **, unsigned int *, unsigned int *, unsigned int *, int *, void (**)(void)))
|
cPlayback::cPlayback(int num __attribute__((unused)), void (*fbcb)(uint32_t **, unsigned int *, unsigned int *, unsigned int *, void (**)(void)))
|
||||||
{
|
{
|
||||||
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
printf("%s:%s\n", FILENAME, __FUNCTION__);
|
||||||
playing=false;
|
playing=false;
|
||||||
|
@@ -19,10 +19,10 @@ class cPlayback
|
|||||||
int mSubtitleStream;
|
int mSubtitleStream;
|
||||||
int mDvbsubtitleStream;
|
int mDvbsubtitleStream;
|
||||||
int mTeletextStream;
|
int mTeletextStream;
|
||||||
void (*framebuffer_callback)(uint32_t **, unsigned int *, unsigned int *, unsigned int *, int *, void (**)(void));
|
void (*framebuffer_callback)(uint32_t **, unsigned int *, unsigned int *, unsigned int *, void (**)(void));
|
||||||
bool Stop(void);
|
bool Stop(void);
|
||||||
public:
|
public:
|
||||||
cPlayback(int num = 0, void (*fbcb)(uint32_t **, unsigned int *, unsigned int *, unsigned int *, int *, void (**)(void)) = NULL);
|
cPlayback(int num = 0, void (*fbcb)(uint32_t **, unsigned int *, unsigned int *, unsigned int *, void (**)(void)) = NULL);
|
||||||
~cPlayback();
|
~cPlayback();
|
||||||
|
|
||||||
bool Open(playmode_t PlayMode);
|
bool Open(playmode_t PlayMode);
|
||||||
|
Reference in New Issue
Block a user