mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 23:13:16 +02:00
fix some movieplayer issues
This commit is contained in:
@@ -108,7 +108,11 @@ static long long int latestPts = 0;
|
|||||||
/* Prototypes */
|
/* Prototypes */
|
||||||
/* ***************************** */
|
/* ***************************** */
|
||||||
static int container_ffmpeg_seek_bytes(off_t pos);
|
static int container_ffmpeg_seek_bytes(off_t pos);
|
||||||
|
#ifdef MARTII
|
||||||
|
static int container_ffmpeg_seek(Context_t *context, float sec, int absolute);
|
||||||
|
#else
|
||||||
static int container_ffmpeg_seek(Context_t *context, float sec);
|
static int container_ffmpeg_seek(Context_t *context, float sec);
|
||||||
|
#endif
|
||||||
static int container_ffmpeg_seek_rel(Context_t *context, off_t pos, long long int pts, float sec);
|
static int container_ffmpeg_seek_rel(Context_t *context, off_t pos, long long int pts, float sec);
|
||||||
static int container_ffmpeg_seek_bytes_rel(off_t start, off_t bytes);
|
static int container_ffmpeg_seek_bytes_rel(off_t start, off_t bytes);
|
||||||
|
|
||||||
@@ -1482,12 +1486,32 @@ static int container_ffmpeg_seek_rel(Context_t *context, off_t pos, long long in
|
|||||||
return cERR_CONTAINER_FFMPEG_NO_ERROR;
|
return cERR_CONTAINER_FFMPEG_NO_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MARTII
|
||||||
|
static int container_ffmpeg_seek(Context_t *context, float sec, int absolute) {
|
||||||
|
#else
|
||||||
static int container_ffmpeg_seek(Context_t *context, float sec) {
|
static int container_ffmpeg_seek(Context_t *context, float sec) {
|
||||||
|
#endif
|
||||||
Track_t * videoTrack = NULL;
|
Track_t * videoTrack = NULL;
|
||||||
Track_t * audioTrack = NULL;
|
Track_t * audioTrack = NULL;
|
||||||
Track_t * current = NULL;
|
Track_t * current = NULL;
|
||||||
int flag = 0;
|
int flag = 0;
|
||||||
|
|
||||||
|
#ifdef MARTII
|
||||||
|
if (absolute) {
|
||||||
|
ffmpeg_printf(10, "goto %f sec\n", sec);
|
||||||
|
|
||||||
|
if (sec < 0.0)
|
||||||
|
sec = 0.0;
|
||||||
|
} else {
|
||||||
|
ffmpeg_printf(10, "seeking %f sec\n", sec);
|
||||||
|
|
||||||
|
if (sec == 0.0)
|
||||||
|
{
|
||||||
|
ffmpeg_err("sec = 0.0 ignoring\n");
|
||||||
|
return cERR_CONTAINER_FFMPEG_ERR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#else
|
||||||
#if !defined(VDR1722)
|
#if !defined(VDR1722)
|
||||||
ffmpeg_printf(10, "seeking %f sec\n", sec);
|
ffmpeg_printf(10, "seeking %f sec\n", sec);
|
||||||
|
|
||||||
@@ -1504,6 +1528,7 @@ static int container_ffmpeg_seek(Context_t *context, float sec) {
|
|||||||
ffmpeg_err("sec < 0.0 ignoring\n");
|
ffmpeg_err("sec < 0.0 ignoring\n");
|
||||||
return cERR_CONTAINER_FFMPEG_ERR;
|
return cERR_CONTAINER_FFMPEG_ERR;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
context->manager->video->Command(context, MANAGER_GET_TRACK, &videoTrack);
|
context->manager->video->Command(context, MANAGER_GET_TRACK, &videoTrack);
|
||||||
context->manager->audio->Command(context, MANAGER_GET_TRACK, &audioTrack);
|
context->manager->audio->Command(context, MANAGER_GET_TRACK, &audioTrack);
|
||||||
@@ -1514,7 +1539,11 @@ static int container_ffmpeg_seek(Context_t *context, float sec) {
|
|||||||
current = audioTrack;
|
current = audioTrack;
|
||||||
|
|
||||||
if (current == NULL) {
|
if (current == NULL) {
|
||||||
|
#ifdef MARTII
|
||||||
|
ffmpeg_err( "no track available to seek\n");
|
||||||
|
#else
|
||||||
ffmpeg_err( "no track avaibale to seek\n");
|
ffmpeg_err( "no track avaibale to seek\n");
|
||||||
|
#endif
|
||||||
return cERR_CONTAINER_FFMPEG_ERR;
|
return cERR_CONTAINER_FFMPEG_ERR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1551,15 +1580,26 @@ static int container_ffmpeg_seek(Context_t *context, float sec) {
|
|||||||
{
|
{
|
||||||
sec *= 180000.0;
|
sec *= 180000.0;
|
||||||
}
|
}
|
||||||
|
#ifdef MARTII
|
||||||
|
if (absolute)
|
||||||
|
pos = sec;
|
||||||
|
else
|
||||||
|
pos += sec;
|
||||||
|
#else
|
||||||
#if !defined(VDR1722)
|
#if !defined(VDR1722)
|
||||||
pos += sec;
|
pos += sec;
|
||||||
#else
|
#else
|
||||||
pos = sec;
|
pos = sec;
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
{
|
{
|
||||||
|
#ifdef MARTII
|
||||||
|
pos = 0;
|
||||||
|
#else
|
||||||
ffmpeg_err("end of file reached\n");
|
ffmpeg_err("end of file reached\n");
|
||||||
return cERR_CONTAINER_FFMPEG_END_OF_FILE;
|
return cERR_CONTAINER_FFMPEG_END_OF_FILE;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
ffmpeg_printf(10, "1. seeking to position %lld bytes ->sec %f\n", pos, sec);
|
ffmpeg_printf(10, "1. seeking to position %lld bytes ->sec %f\n", pos, sec);
|
||||||
@@ -1573,8 +1613,13 @@ static int container_ffmpeg_seek(Context_t *context, float sec) {
|
|||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
#ifdef MARTII
|
||||||
|
if (!absolute)
|
||||||
|
sec += ((float) current->pts / 90000.0f);
|
||||||
|
#else
|
||||||
#if !defined(VDR1722)
|
#if !defined(VDR1722)
|
||||||
sec += ((float) current->pts / 90000.0f);
|
sec += ((float) current->pts / 90000.0f);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
ffmpeg_printf(10, "2. seeking to position %f sec ->time base %f %d\n", sec, av_q2d(((AVStream*) current->stream)->time_base), AV_TIME_BASE);
|
ffmpeg_printf(10, "2. seeking to position %f sec ->time base %f %d\n", sec, av_q2d(((AVStream*) current->stream)->time_base), AV_TIME_BASE);
|
||||||
|
|
||||||
@@ -1737,9 +1782,19 @@ static int Command(void *_context, ContainerCmd_t command, void * argument)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CONTAINER_SEEK: {
|
case CONTAINER_SEEK: {
|
||||||
|
#ifdef MARTII
|
||||||
|
ret = container_ffmpeg_seek(context, (float)*((float*)argument), 0);
|
||||||
|
#else
|
||||||
ret = container_ffmpeg_seek(context, (float)*((float*)argument));
|
ret = container_ffmpeg_seek(context, (float)*((float*)argument));
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef MARTII
|
||||||
|
case CONTAINER_SEEK_ABS: {
|
||||||
|
ret = container_ffmpeg_seek(context, (float)*((float*)argument), -1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
case CONTAINER_LENGTH: {
|
case CONTAINER_LENGTH: {
|
||||||
double length = 0;
|
double length = 0;
|
||||||
ret = container_ffmpeg_get_length(context, &length);
|
ret = container_ffmpeg_get_length(context, &length);
|
||||||
|
@@ -10,6 +10,9 @@ CONTAINER_CAPABILITIES,
|
|||||||
CONTAINER_PLAY,
|
CONTAINER_PLAY,
|
||||||
CONTAINER_STOP,
|
CONTAINER_STOP,
|
||||||
CONTAINER_SEEK,
|
CONTAINER_SEEK,
|
||||||
|
#ifdef MARTII
|
||||||
|
CONTAINER_SEEK_ABS,
|
||||||
|
#endif
|
||||||
CONTAINER_LENGTH,
|
CONTAINER_LENGTH,
|
||||||
CONTAINER_DEL,
|
CONTAINER_DEL,
|
||||||
CONTAINER_SWITCH_AUDIO,
|
CONTAINER_SWITCH_AUDIO,
|
||||||
|
@@ -2,7 +2,11 @@
|
|||||||
#define PLAYBACK_H_
|
#define PLAYBACK_H_
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
#ifdef MARTII
|
||||||
|
typedef enum {PLAYBACK_OPEN, PLAYBACK_CLOSE, PLAYBACK_PLAY, PLAYBACK_STOP, PLAYBACK_PAUSE, PLAYBACK_CONTINUE, PLAYBACK_FLUSH, PLAYBACK_TERM, PLAYBACK_FASTFORWARD, PLAYBACK_SEEK, PLAYBACK_SEEK_ABS, PLAYBACK_PTS, PLAYBACK_LENGTH, PLAYBACK_SWITCH_AUDIO, PLAYBACK_SWITCH_SUBTITLE, PLAYBACK_INFO, PLAYBACK_SLOWMOTION, PLAYBACK_FASTBACKWARD, PLAYBACK_GET_FRAME_COUNT} PlaybackCmd_t;
|
||||||
|
#else
|
||||||
typedef enum {PLAYBACK_OPEN, PLAYBACK_CLOSE, PLAYBACK_PLAY, PLAYBACK_STOP, PLAYBACK_PAUSE, PLAYBACK_CONTINUE, PLAYBACK_FLUSH, PLAYBACK_TERM, PLAYBACK_FASTFORWARD, PLAYBACK_SEEK, PLAYBACK_PTS, PLAYBACK_LENGTH, PLAYBACK_SWITCH_AUDIO, PLAYBACK_SWITCH_SUBTITLE, PLAYBACK_INFO, PLAYBACK_SLOWMOTION, PLAYBACK_FASTBACKWARD, PLAYBACK_GET_FRAME_COUNT} PlaybackCmd_t;
|
typedef enum {PLAYBACK_OPEN, PLAYBACK_CLOSE, PLAYBACK_PLAY, PLAYBACK_STOP, PLAYBACK_PAUSE, PLAYBACK_CONTINUE, PLAYBACK_FLUSH, PLAYBACK_TERM, PLAYBACK_FASTFORWARD, PLAYBACK_SEEK, PLAYBACK_PTS, PLAYBACK_LENGTH, PLAYBACK_SWITCH_AUDIO, PLAYBACK_SWITCH_SUBTITLE, PLAYBACK_INFO, PLAYBACK_SLOWMOTION, PLAYBACK_FASTBACKWARD, PLAYBACK_GET_FRAME_COUNT} PlaybackCmd_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct PlaybackHandler_s {
|
typedef struct PlaybackHandler_s {
|
||||||
char * Name;
|
char * Name;
|
||||||
|
@@ -756,7 +756,11 @@ static int PlaybackSlowMotion(Context_t *context,int* speed) {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MARTII
|
||||||
|
static int PlaybackSeek(Context_t *context, float * pos, int absolute) {
|
||||||
|
#else
|
||||||
static int PlaybackSeek(Context_t *context, float * pos) {
|
static int PlaybackSeek(Context_t *context, float * pos) {
|
||||||
|
#endif
|
||||||
int ret = cERR_PLAYBACK_NO_ERROR;
|
int ret = cERR_PLAYBACK_NO_ERROR;
|
||||||
|
|
||||||
playback_printf(10, "pos: %f\n", *pos);
|
playback_printf(10, "pos: %f\n", *pos);
|
||||||
@@ -766,6 +770,11 @@ static int PlaybackSeek(Context_t *context, float * pos) {
|
|||||||
|
|
||||||
context->output->Command(context, OUTPUT_CLEAR, NULL);
|
context->output->Command(context, OUTPUT_CLEAR, NULL);
|
||||||
|
|
||||||
|
#ifdef MARTII
|
||||||
|
if (absolute)
|
||||||
|
context->container->selectedContainer->Command(context, CONTAINER_SEEK_ABS, pos);
|
||||||
|
else
|
||||||
|
#endif
|
||||||
context->container->selectedContainer->Command(context, CONTAINER_SEEK, pos);
|
context->container->selectedContainer->Command(context, CONTAINER_SEEK, pos);
|
||||||
|
|
||||||
context->playback->isSeeking = 0;
|
context->playback->isSeeking = 0;
|
||||||
@@ -990,9 +999,19 @@ static int Command(void* _context, PlaybackCmd_t command, void * argument) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case PLAYBACK_SEEK: {
|
case PLAYBACK_SEEK: {
|
||||||
|
#ifdef MARTII
|
||||||
|
ret = PlaybackSeek(context, (float*)argument, 0);
|
||||||
|
#else
|
||||||
ret = PlaybackSeek(context, (float*)argument);
|
ret = PlaybackSeek(context, (float*)argument);
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#ifdef MARTII
|
||||||
|
case PLAYBACK_SEEK_ABS: {
|
||||||
|
ret = PlaybackSeek(context, (float*)argument, -1);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
case PLAYBACK_PTS: { // 10
|
case PLAYBACK_PTS: { // 10
|
||||||
ret = PlaybackPts(context, (unsigned long long int*)argument);
|
ret = PlaybackPts(context, (unsigned long long int*)argument);
|
||||||
break;
|
break;
|
||||||
|
@@ -414,7 +414,11 @@ bool cPlayback::SetPosition(int position, bool absolute)
|
|||||||
}
|
}
|
||||||
float pos = (position/1000.0);
|
float pos = (position/1000.0);
|
||||||
if(player && player->playback)
|
if(player && player->playback)
|
||||||
|
#ifdef MARTII
|
||||||
|
player->playback->Command(player, absolute ? PLAYBACK_SEEK_ABS : PLAYBACK_SEEK, (void*)&pos);
|
||||||
|
#else
|
||||||
player->playback->Command(player, PLAYBACK_SEEK, (void*)&pos);
|
player->playback->Command(player, PLAYBACK_SEEK, (void*)&pos);
|
||||||
|
#endif
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user