mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-27 23:42:43 +02:00
[libarmbox] libeplayer3-arm code format
Origin commit data
------------------
Branch: master
Commit: 6886c61e10
Author: max_10 <max_10@gmx.de>
Date: 2018-08-30 (Thu, 30 Aug 2018)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -105,6 +105,7 @@ if (debug_level >= level) printf("[%s:%s] " fmt, __FILE__, __FUNCTION__, ## x);
|
||||
#define cERR_CONTAINER_FFMPEG_END_OF_FILE -10
|
||||
|
||||
#define IPTV_AV_CONTEXT_MAX_NUM 2
|
||||
|
||||
/* ***************************** */
|
||||
/* Types */
|
||||
/* ***************************** */
|
||||
@@ -548,8 +549,7 @@ static void FFMPEGThread(Context_t *context)
|
||||
threadname[16] = 0;
|
||||
prctl(PR_SET_NAME, (unsigned long)&threadname);
|
||||
AVPacket packet;
|
||||
//off_t lastSeek = -1;
|
||||
//int64_t lastPts = -1;
|
||||
|
||||
int64_t currentVideoPts = -1;
|
||||
int64_t currentAudioPts = -1;
|
||||
|
||||
@@ -561,7 +561,6 @@ static void FFMPEGThread(Context_t *context)
|
||||
|
||||
int64_t showtime = 0;
|
||||
int64_t bofcount = 0;
|
||||
//int32_t err = 0;
|
||||
AudioVideoOut_t avOut;
|
||||
|
||||
g_context = context;
|
||||
@@ -583,6 +582,7 @@ static void FFMPEGThread(Context_t *context)
|
||||
memset(&flv2mpeg4_context, 0, sizeof(Flv2Mpeg4Context));
|
||||
#endif
|
||||
ffmpeg_printf(10, "\n");
|
||||
|
||||
while (context->playback->isCreationPhase)
|
||||
{
|
||||
ffmpeg_printf(10, "Thread waiting for end of init phase...\n");
|
||||
@@ -597,6 +597,7 @@ static void FFMPEGThread(Context_t *context)
|
||||
#endif
|
||||
|
||||
int8_t isWaitingForFinish = 0;
|
||||
|
||||
while (context && context->playback && context->playback->isPlaying)
|
||||
{
|
||||
/* When user press PAUSE we call pause on AUDIO and VIDEO decoders,
|
||||
@@ -636,19 +637,24 @@ static void FFMPEGThread(Context_t *context)
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (context->playback->BackWard && av_gettime() >= showtime) {
|
||||
|
||||
if (context->playback->BackWard && av_gettime() >= showtime)
|
||||
{
|
||||
context->output->Command(context, OUTPUT_CLEAR, "video");
|
||||
|
||||
if (bofcount == 1) {
|
||||
if (bofcount == 1)
|
||||
{
|
||||
showtime = av_gettime();
|
||||
usleep(100000);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (avContextTab[0]->iformat->flags & AVFMT_TS_DISCONT) {
|
||||
if (avContextTab[0]->iformat->flags & AVFMT_TS_DISCONT)
|
||||
{
|
||||
off_t pos = avio_tell(avContextTab[0]->pb);
|
||||
|
||||
if (pos > 0) {
|
||||
if (pos > 0)
|
||||
{
|
||||
float br;
|
||||
if (avContextTab[0]->bit_rate)
|
||||
br = avContextTab[0]->bit_rate / 8.0;
|
||||
@@ -779,6 +785,7 @@ static void FFMPEGThread(Context_t *context)
|
||||
int32_t pid = avContextTab[cAVIdx]->streams[packet.stream_index]->id;
|
||||
|
||||
reset_finish_timeout();
|
||||
|
||||
if (avContextTab[cAVIdx]->streams[packet.stream_index]->discard != AVDISCARD_ALL)
|
||||
{
|
||||
if (context->manager->video->Command(context, MANAGER_GET_TRACK, &videoTrack) < 0)
|
||||
@@ -992,6 +999,7 @@ static void FFMPEGThread(Context_t *context)
|
||||
decoded_frame = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#if (LIBAVFORMAT_VERSION_MAJOR > 57) || ((LIBAVFORMAT_VERSION_MAJOR == 57) && (LIBAVFORMAT_VERSION_MINOR > 32))
|
||||
while (packet.size > 0 || (!packet.size && !packet.data))
|
||||
#else
|
||||
@@ -1059,6 +1067,7 @@ static void FFMPEGThread(Context_t *context)
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
int32_t e = 0;
|
||||
if (!swr)
|
||||
{
|
||||
@@ -1085,6 +1094,7 @@ static void FFMPEGThread(Context_t *context)
|
||||
{
|
||||
c->channel_layout = av_get_default_channel_layout(c->channels);
|
||||
}
|
||||
|
||||
out_channel_layout = c->channel_layout;
|
||||
|
||||
uint8_t downmix = stereo_software_decoder && out_channels > 2 ? 1 : 0;
|
||||
@@ -1108,7 +1118,6 @@ static void FFMPEGThread(Context_t *context)
|
||||
av_opt_set_int(swr, "in_sample_fmt", c->sample_fmt, 0);
|
||||
av_opt_set_int(swr, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0);
|
||||
|
||||
|
||||
e = swr_init(swr);
|
||||
if (e < 0)
|
||||
{
|
||||
@@ -1346,6 +1355,7 @@ static void FFMPEGThread(Context_t *context)
|
||||
seek_target_seconds = 0;
|
||||
do_seek_target_seconds = 0;
|
||||
PlaybackDieNow(1);
|
||||
|
||||
ffmpeg_printf(10, "terminating\n");
|
||||
}
|
||||
|
||||
@@ -1888,13 +1898,16 @@ int32_t container_ffmpeg_init(Context_t *context, PlayFiles_t *playFilesNames)
|
||||
}
|
||||
|
||||
ffmpeg_printf(10, "filename %s\n", playFilesNames->szFirstFile);
|
||||
|
||||
if (playFilesNames->szSecondFile)
|
||||
{
|
||||
ffmpeg_printf(10, "second filename %s\n", playFilesNames->szSecondFile);
|
||||
}
|
||||
|
||||
/* initialize ffmpeg */
|
||||
avcodec_register_all();
|
||||
av_register_all();
|
||||
|
||||
avformat_network_init();
|
||||
|
||||
// SULGE DEBUG ENABLED
|
||||
@@ -1905,6 +1918,7 @@ int32_t container_ffmpeg_init(Context_t *context, PlayFiles_t *playFilesNames)
|
||||
context->playback->abortRequested = 0;
|
||||
int32_t res = container_ffmpeg_init_av_context(context, playFilesNames->szFirstFile, playFilesNames->iFirstFileSize, \
|
||||
playFilesNames->szFirstMoovAtomFile, playFilesNames->iFirstMoovAtomOffset, 0);
|
||||
|
||||
if (0 != res)
|
||||
{
|
||||
return res;
|
||||
@@ -1972,6 +1986,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
|
||||
|
||||
|
||||
uint32_t cAVIdx = 0;
|
||||
|
||||
for (cAVIdx = 0; cAVIdx < IPTV_AV_CONTEXT_MAX_NUM; cAVIdx += 1)
|
||||
{
|
||||
if (NULL == avContextTab[cAVIdx])
|
||||
@@ -2082,6 +2097,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
ffmpeg_printf(10, "CODEC_TYPE_VIDEO %d\n", get_codecpar(stream)->codec_type);
|
||||
stream->discard = AVDISCARD_ALL; /* by default we discard all video streams */
|
||||
|
||||
if (encoding != NULL)
|
||||
{
|
||||
track.type = eTypeES;
|
||||
@@ -2098,6 +2114,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
|
||||
*/
|
||||
track.aspect_ratio_num = stream->sample_aspect_ratio.num;
|
||||
track.aspect_ratio_den = stream->sample_aspect_ratio.den;
|
||||
|
||||
if (0 == track.aspect_ratio_num || 0 == track.aspect_ratio_den)
|
||||
{
|
||||
track.aspect_ratio_num = get_codecpar(stream)->sample_aspect_ratio.num;
|
||||
@@ -2117,6 +2134,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
|
||||
}
|
||||
|
||||
/* fixme: revise this */
|
||||
|
||||
if (track.frame_rate < 23970)
|
||||
{
|
||||
track.TimeScale = 1001;
|
||||
@@ -2181,6 +2199,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
ffmpeg_printf(10, "CODEC_TYPE_AUDIO %d\n", get_codecpar(stream)->codec_type);
|
||||
stream->discard = AVDISCARD_ALL;
|
||||
|
||||
if (encoding != NULL)
|
||||
{
|
||||
AVDictionaryEntry *lang;
|
||||
@@ -2199,6 +2218,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
|
||||
track.have_aacheader = -1;
|
||||
|
||||
track.duration = (int64_t)av_rescale(stream->duration, (int64_t)stream->time_base.num * 1000, stream->time_base.den);
|
||||
|
||||
if (stream->duration == AV_NOPTS_VALUE)
|
||||
{
|
||||
ffmpeg_printf(10, "Stream has no duration so we take the duration from context\n");
|
||||
@@ -2516,7 +2536,9 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
|
||||
ffmpeg_printf(10, "CODEC_TYPE_SUBTITLE %d\n", get_codecpar(stream)->codec_type);
|
||||
|
||||
lang = av_dict_get(stream->metadata, "language", NULL, 0);
|
||||
|
||||
track.Name = lang ? lang->value : "und";
|
||||
|
||||
ffmpeg_printf(10, "Language %s\n", track.Name);
|
||||
|
||||
track.Encoding = encoding;
|
||||
@@ -2597,6 +2619,7 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
|
||||
}
|
||||
|
||||
releaseMutex(__FILE__, __FUNCTION__, __LINE__);
|
||||
|
||||
return cERR_CONTAINER_FFMPEG_NO_ERROR;
|
||||
}
|
||||
|
||||
@@ -2625,14 +2648,12 @@ static int32_t container_ffmpeg_play(Context_t *context)
|
||||
if ((error = pthread_create(&PlayThread, &attr, (void *)&FFMPEGThread, context)) != 0)
|
||||
{
|
||||
ffmpeg_printf(10, "Error creating thread, error:%d:%s\n", error, strerror(error));
|
||||
|
||||
hasPlayThreadStarted = 0;
|
||||
ret = cERR_CONTAINER_FFMPEG_ERR;
|
||||
}
|
||||
else
|
||||
{
|
||||
ffmpeg_printf(10, "Created thread\n");
|
||||
|
||||
hasPlayThreadStarted = 1;
|
||||
}
|
||||
}
|
||||
@@ -2643,6 +2664,7 @@ static int32_t container_ffmpeg_play(Context_t *context)
|
||||
}
|
||||
|
||||
ffmpeg_printf(10, "exiting with value %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -2672,6 +2694,7 @@ static int32_t container_ffmpeg_stop(Context_t *context)
|
||||
{
|
||||
/* force close */
|
||||
ffmpeg_err("Timeout waiting for thread!\n");
|
||||
|
||||
ret = cERR_CONTAINER_FFMPEG_ERR;
|
||||
/* to speed up close - we are in separate process for the moment this process will
|
||||
* be closed and whole resources will be free by the system
|
||||
@@ -2923,6 +2946,7 @@ static int32_t container_ffmpeg_seek(Context_t *context, int64_t sec, uint8_t ab
|
||||
}
|
||||
|
||||
ffmpeg_printf(10, "iformat->flags 0x%08x\n", avContextTab[0]->iformat->flags);
|
||||
|
||||
#if defined(TS_BYTES_SEEKING) && TS_BYTES_SEEKING
|
||||
if (avContextTab[0]->iformat->flags & AVFMT_TS_DISCONT)
|
||||
{
|
||||
@@ -3029,6 +3053,7 @@ static int32_t container_ffmpeg_switch_audio(Context_t *context, int32_t *arg __
|
||||
{
|
||||
ffmpeg_printf(10, "track %d\n", *arg);
|
||||
getMutex(__FILE__, __FUNCTION__, __LINE__);
|
||||
|
||||
if (context->manager->audio)
|
||||
{
|
||||
Track_t *Tracks = NULL;
|
||||
@@ -3298,6 +3323,7 @@ static int32_t Command(Context_t *context, ContainerCmd_t command, void *argumen
|
||||
}
|
||||
|
||||
ffmpeg_printf(50, "exiting with value %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -45,7 +45,6 @@ typedef struct ContainerHandler_s
|
||||
{
|
||||
char *Name;
|
||||
Container_t *selectedContainer;
|
||||
|
||||
int (* Command)(Context_t *, ContainerCmd_t, void *);
|
||||
} ContainerHandler_t;
|
||||
|
||||
|
@@ -252,7 +252,8 @@ static int HandleTracks(const Manager_t *ptrManager, const PlaybackCmd_t playbac
|
||||
ptrManager->Command(g_player, MANAGER_LIST, &TrackList);
|
||||
if (NULL != TrackList)
|
||||
{
|
||||
int i = 0, Id = -1;
|
||||
int i = 0;
|
||||
int Id = -1;
|
||||
char * pch;
|
||||
char Name[] = " ";
|
||||
fprintf(stderr, "{\"%c_%c\": [", argvBuff[0], argvBuff[1]);
|
||||
@@ -657,6 +658,7 @@ static int ParseParams(int argc, char *argv[], PlayFiles_t *playbackFiles, int *
|
||||
ret = 0;
|
||||
playbackFiles->szFirstFile = malloc(IPTV_MAX_FILE_PATH);
|
||||
playbackFiles->szFirstFile[0] = '\0';
|
||||
|
||||
if (NULL == strstr(argv[optind], "://"))
|
||||
{
|
||||
strcpy(playbackFiles->szFirstFile, "file://");
|
||||
@@ -693,6 +695,7 @@ int main(int argc, char *argv[])
|
||||
|
||||
PlayFiles_t playbackFiles;
|
||||
memset(&playbackFiles, 0x00, sizeof(playbackFiles));
|
||||
|
||||
if (0 != ParseParams(argc, argv, &playbackFiles, &audioTrackIdx, &subtitleTrackIdx, &linuxDvbBufferSizeMB))
|
||||
{
|
||||
printf("Usage: exteplayer3 filePath [-u user-agent] [-c cookies] [-h headers] [-p prio] [-a] [-d] [-w] [-l] [-s] [-i] [-t audioTrackId] [-9 subtitleTrackId] [-x separateAudioUri] plabackUri\n");
|
||||
@@ -966,10 +969,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
commandRetVal = g_player->playback->Command(g_player, PLAYBACK_PTS, &pts);
|
||||
CurrentSec = (int32_t)(pts / 90000);
|
||||
|
||||
if (0 == commandRetVal)
|
||||
{
|
||||
fprintf(stderr, "{\"J\":{\"ms\":%lld}}\n", pts / 90);
|
||||
}
|
||||
|
||||
if (0 == commandRetVal || force)
|
||||
{
|
||||
commandRetVal = g_player->playback->Command(g_player, PLAYBACK_LENGTH, (void *)&length);
|
||||
@@ -1016,6 +1021,7 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
int64_t lastPts = 0;
|
||||
commandRetVal = 1;
|
||||
|
||||
if (g_player->container && g_player->container->selectedContainer)
|
||||
{
|
||||
commandRetVal = g_player->container->selectedContainer->Command((Context_t*)g_player->container, CONTAINER_LAST_PTS, &lastPts);
|
||||
|
@@ -128,6 +128,7 @@ static int ManagerAdd(Context_t *context, Track_t track)
|
||||
}
|
||||
|
||||
audio_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
|
||||
|
||||
return cERR_AUDIO_MGR_NO_ERROR;
|
||||
}
|
||||
|
||||
@@ -137,6 +138,7 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
|
||||
char **tracklist = NULL;
|
||||
|
||||
audio_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
|
||||
|
||||
if (Tracks != NULL)
|
||||
{
|
||||
tracklist = malloc(sizeof(char *) * ((TrackCount * 2) + 1));
|
||||
@@ -160,9 +162,9 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
|
||||
tracklist[j] = strdup(tmp);
|
||||
tracklist[j + 1] = strdup(Tracks[i].Encoding);
|
||||
}
|
||||
|
||||
tracklist[j] = NULL;
|
||||
}
|
||||
|
||||
audio_mgr_printf(10, "%s::%s return %p (%d - %d)\n", __FILE__, __FUNCTION__, tracklist, j, TrackCount);
|
||||
|
||||
return tracklist;
|
||||
|
@@ -134,8 +134,8 @@ static int ManagerAdd(Context_t *context __attribute__((unused)), Track_t track)
|
||||
|
||||
static char **ManagerList(Context_t *context __attribute__((unused)))
|
||||
{
|
||||
char **tracklist = NULL;
|
||||
int i = 0, j = 0;
|
||||
char **tracklist = NULL;
|
||||
|
||||
subtitle_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
|
||||
|
||||
@@ -162,7 +162,6 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
|
||||
tracklist[j] = strdup(tmp);
|
||||
tracklist[j + 1] = strdup(Tracks[i].Encoding);
|
||||
}
|
||||
|
||||
tracklist[j] = NULL;
|
||||
}
|
||||
|
||||
@@ -332,12 +331,12 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
|
||||
break;
|
||||
}
|
||||
default:
|
||||
subtitle_mgr_err("%s:%s: ContainerCmd not supported!", __FILE__, __FUNCTION__);
|
||||
subtitle_mgr_err("%s::%s ContainerCmd not supported!", __FILE__, __FUNCTION__);
|
||||
ret = cERR_SUBTITLE_MGR_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
subtitle_mgr_printf(50, "%s:%s: returning %d\n", __FILE__, __FUNCTION__, ret);
|
||||
subtitle_mgr_printf(50, "%s::%s returning %d\n", __FILE__, __FUNCTION__, ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
@@ -97,7 +97,7 @@ static int ManagerAdd(Context_t *context, Track_t track)
|
||||
|
||||
if (Tracks == NULL)
|
||||
{
|
||||
video_mgr_err("%s:%s malloc failed\n", __FILE__, __FUNCTION__);
|
||||
video_mgr_err("%s::%s malloc failed\n", __FILE__, __FUNCTION__);
|
||||
return cERR_VIDEO_MGR_ERROR;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ static int ManagerAdd(Context_t *context, Track_t track)
|
||||
}
|
||||
else
|
||||
{
|
||||
video_mgr_err("%s:%s TrackCount out if range %d - %d\n", __FILE__, __FUNCTION__, TrackCount, TRACKWRAP);
|
||||
video_mgr_err("%s::%s TrackCount out if range %d - %d\n", __FILE__, __FUNCTION__, TrackCount, TRACKWRAP);
|
||||
return cERR_VIDEO_MGR_ERROR;
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ static int ManagerAdd(Context_t *context, Track_t track)
|
||||
}
|
||||
|
||||
video_mgr_printf(10, "%s::%s\n", __FILE__, __FUNCTION__);
|
||||
|
||||
return cERR_VIDEO_MGR_NO_ERROR;
|
||||
}
|
||||
|
||||
@@ -144,7 +145,7 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
|
||||
|
||||
if (tracklist == NULL)
|
||||
{
|
||||
video_mgr_err("%s:%s malloc failed\n", __FILE__, __FUNCTION__);
|
||||
video_mgr_err("%s::%s malloc failed\n", __FILE__, __FUNCTION__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -164,6 +165,7 @@ static char **ManagerList(Context_t *context __attribute__((unused)))
|
||||
}
|
||||
|
||||
video_mgr_printf(10, "%s::%s return %p (%d - %d)\n", __FILE__, __FUNCTION__, tracklist, j, TrackCount);
|
||||
|
||||
return tracklist;
|
||||
}
|
||||
|
||||
@@ -342,7 +344,7 @@ static int Command(Context_t *context, ManagerCmd_t command, void *argument)
|
||||
break;
|
||||
}
|
||||
|
||||
video_mgr_printf(10, "%s:%s: returning %d\n", __FILE__, __FUNCTION__, ret);
|
||||
video_mgr_printf(10, "%s::%s returning %d\n", __FILE__, __FUNCTION__, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -252,6 +252,7 @@ int LinuxDvbPlay(Context_t *context, char *type)
|
||||
linuxdvb_printf(10, "V %s\n", Encoding);
|
||||
|
||||
writer = getWriter(Encoding);
|
||||
|
||||
if (writer == NULL)
|
||||
{
|
||||
linuxdvb_err("cannot found writer for encoding %s using default\n", Encoding);
|
||||
@@ -324,7 +325,6 @@ int LinuxDvbPlay(Context_t *context, char *type)
|
||||
|
||||
ret = cERR_LINUXDVB_NO_ERROR;
|
||||
return ret;
|
||||
//return 0;
|
||||
}
|
||||
|
||||
int LinuxDvbStop(Context_t *context __attribute__((unused)), char *type)
|
||||
@@ -354,6 +354,7 @@ int LinuxDvbStop(Context_t *context __attribute__((unused)), char *type)
|
||||
ioctl(videofd, VIDEO_FAST_FORWARD, 0);
|
||||
ioctl(videofd, VIDEO_SELECT_SOURCE, VIDEO_SOURCE_DEMUX);
|
||||
}
|
||||
|
||||
if (audio && audiofd != -1)
|
||||
{
|
||||
if (ioctl(audiofd, AUDIO_CLEAR_BUFFER) == -1)
|
||||
@@ -634,6 +635,7 @@ int LinuxDvbPts(Context_t *context __attribute__((unused)), unsigned long long i
|
||||
}
|
||||
|
||||
*((unsigned long long int *)pts) = (unsigned long long int)sCURRENT_PTS;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -90,6 +90,7 @@ static void printOutputCapabilities()
|
||||
for (i = 0; AvailableOutput[i] != NULL; i++)
|
||||
{
|
||||
output_printf(10, "\t%s : ", AvailableOutput[i]->Name);
|
||||
|
||||
for (j = 0; AvailableOutput[i]->Capabilities[j] != NULL; j++)
|
||||
{
|
||||
output_printf(10, "%s ", AvailableOutput[i]->Capabilities[j]);
|
||||
|
@@ -266,8 +266,6 @@ static int32_t subtitle_Open(Context_t *context __attribute__((unused)))
|
||||
|
||||
static int32_t subtitle_Close(Context_t *context __attribute__((unused)))
|
||||
{
|
||||
//uint32_t i = 0 ;
|
||||
|
||||
subtitle_printf(10, "\n");
|
||||
|
||||
getMutex(__LINE__);
|
||||
@@ -341,6 +339,7 @@ static int Command(Context_t *context, OutputCmd_t command, void *argument __att
|
||||
}
|
||||
|
||||
subtitle_printf(50, "exiting with value %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@@ -52,6 +52,7 @@
|
||||
/* ***************************** */
|
||||
/* Makros/Constants */
|
||||
/* ***************************** */
|
||||
|
||||
#define PES_AUDIO_PRIVATE_HEADER_SIZE 16 // consider maximum private header size.
|
||||
#define PES_AUDIO_HEADER_SIZE (32 + PES_AUDIO_PRIVATE_HEADER_SIZE)
|
||||
#define PES_AUDIO_PACKET_SIZE 2028
|
||||
|
@@ -169,6 +169,7 @@ static int writeData(WriterAVCallData_t *call)
|
||||
iov[0].iov_len = headerSize;
|
||||
iov[1].iov_base = call->data;
|
||||
iov[1].iov_len = call->len;
|
||||
|
||||
return call->WriteV(call->fd, iov, 2);
|
||||
}
|
||||
|
||||
|
@@ -140,6 +140,7 @@ static void SupervisorThread(Context_t *context)
|
||||
{
|
||||
usleep(100000);
|
||||
}
|
||||
|
||||
playback_printf(10, "<\n");
|
||||
hasThreadStarted = 2;
|
||||
PlaybackTerminate(context);
|
||||
@@ -293,6 +294,7 @@ static int PlaybackPlay(Context_t *context)
|
||||
{
|
||||
playback_err("OUTPUT_PLAY failed!\n");
|
||||
playback_err("clearing isCreationPhase!\n");
|
||||
|
||||
context->playback->isCreationPhase = 0; // allow thread to go into next state
|
||||
context->playback->isPlaying = 0;
|
||||
context->playback->isPaused = 0;
|
||||
@@ -300,6 +302,7 @@ static int PlaybackPlay(Context_t *context)
|
||||
context->playback->BackWard = 0;
|
||||
context->playback->SlowMotion = 0;
|
||||
context->playback->Speed = 0;
|
||||
|
||||
if (context->container && context->container->selectedContainer)
|
||||
context->container->selectedContainer->Command(context, CONTAINER_STOP, NULL);
|
||||
}
|
||||
@@ -317,6 +320,7 @@ static int PlaybackPlay(Context_t *context)
|
||||
int error;
|
||||
pthread_attr_init(&attr);
|
||||
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
|
||||
|
||||
if ((error = pthread_create(&supervisorThread, &attr, (void *)&SupervisorThread, context)) != 0)
|
||||
{
|
||||
playback_printf(10, "Error creating thread, error:%d:%s\n", error, strerror(error));
|
||||
@@ -331,13 +335,14 @@ static int PlaybackPlay(Context_t *context)
|
||||
playback_printf(10, "clearing isCreationPhase!\n");
|
||||
|
||||
context->playback->isCreationPhase = 0; // allow thread to go into next state
|
||||
|
||||
if (context->container && context->container->selectedContainer)
|
||||
ret = context->container->selectedContainer->Command(context, CONTAINER_PLAY, NULL);
|
||||
|
||||
if (ret != 0)
|
||||
{
|
||||
playback_err("CONTAINER_PLAY failed!\n");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -362,10 +367,9 @@ static int PlaybackPause(Context_t *context)
|
||||
if (context->playback->SlowMotion)
|
||||
context->output->Command(context, OUTPUT_CLEAR, NULL);
|
||||
|
||||
context->playback->isPaused = 1;
|
||||
|
||||
context->output->Command(context, OUTPUT_PAUSE, NULL);
|
||||
|
||||
context->playback->isPaused = 1;
|
||||
//context->playback->isPlaying = 1;
|
||||
context->playback->isForwarding = 0;
|
||||
context->playback->BackWard = 0;
|
||||
@@ -395,6 +399,8 @@ static int32_t PlaybackContinue(Context_t *context)
|
||||
if (context->playback->SlowMotion || context->playback->isForwarding || context->playback->BackWard)
|
||||
context->output->Command(context, OUTPUT_CLEAR, NULL);
|
||||
|
||||
context->output->Command(context, OUTPUT_CONTINUE, NULL);
|
||||
|
||||
if (context->playback->BackWard)
|
||||
context->output->Command(context, OUTPUT_AUDIOMUTE, "0");
|
||||
|
||||
@@ -404,7 +410,6 @@ static int32_t PlaybackContinue(Context_t *context)
|
||||
context->playback->BackWard = 0;
|
||||
context->playback->SlowMotion = 0;
|
||||
context->playback->Speed = 1;
|
||||
context->output->Command(context, OUTPUT_CONTINUE, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -413,6 +418,7 @@ static int32_t PlaybackContinue(Context_t *context)
|
||||
}
|
||||
|
||||
playback_printf(10, "exiting with value %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -427,7 +433,6 @@ static int32_t PlaybackStop(Context_t *context)
|
||||
|
||||
if (context && context->playback && context->playback->isPlaying)
|
||||
{
|
||||
|
||||
context->playback->isPaused = 0;
|
||||
context->playback->isPlaying = 0;
|
||||
context->playback->isForwarding = 0;
|
||||
@@ -437,7 +442,6 @@ static int32_t PlaybackStop(Context_t *context)
|
||||
|
||||
context->output->Command(context, OUTPUT_STOP, NULL);
|
||||
context->container->selectedContainer->Command(context, CONTAINER_STOP, NULL);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -458,13 +462,13 @@ static int32_t PlaybackStop(Context_t *context)
|
||||
}
|
||||
|
||||
playback_printf(10, "exiting with value %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int32_t PlaybackTerminate(Context_t *context)
|
||||
{
|
||||
int32_t ret = cERR_PLAYBACK_NO_ERROR;
|
||||
|
||||
int wait_time = 20;
|
||||
|
||||
playback_printf(20, "\n");
|
||||
@@ -474,12 +478,13 @@ static int32_t PlaybackTerminate(Context_t *context)
|
||||
if (context && context->playback && context->playback->isPlaying)
|
||||
{
|
||||
//First Flush and than delete container, else e2 cant read length of file anymore
|
||||
|
||||
if (context->output->Command(context, OUTPUT_FLUSH, NULL) < 0)
|
||||
{
|
||||
playback_err("failed to flush output.\n");
|
||||
}
|
||||
|
||||
ret = context->container->selectedContainer->Command(context, CONTAINER_STOP, NULL);
|
||||
|
||||
context->playback->isPaused = 0;
|
||||
context->playback->isPlaying = 0;
|
||||
context->playback->isForwarding = 0;
|
||||
@@ -487,7 +492,6 @@ static int32_t PlaybackTerminate(Context_t *context)
|
||||
context->playback->SlowMotion = 0;
|
||||
context->playback->Speed = 0;
|
||||
context->output->Command(context, OUTPUT_STOP, NULL);
|
||||
ret = context->container->selectedContainer->Command(context, CONTAINER_STOP, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -512,6 +516,7 @@ static int32_t PlaybackTerminate(Context_t *context)
|
||||
}
|
||||
|
||||
playback_printf(20, "exiting with value %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -529,6 +534,7 @@ static int PlaybackFastForward(Context_t *context, int *speed)
|
||||
playback_err("speed %d out of range (1 - %d) \n", *speed, cMaxSpeed_ff);
|
||||
return cERR_PLAYBACK_ERROR;
|
||||
}
|
||||
|
||||
context->playback->isForwarding = 1;
|
||||
context->playback->Speed = *speed;
|
||||
playback_printf(20, "Speed: %d x {%d}\n", *speed, context->playback->Speed);
|
||||
@@ -561,6 +567,7 @@ static int PlaybackFastBackward(Context_t *context, int *speed)
|
||||
playback_err("speed %d out of range (0 - %d) \n", *speed, cMaxSpeed_fr);
|
||||
return cERR_PLAYBACK_ERROR;
|
||||
}
|
||||
|
||||
if (*speed == 0)
|
||||
{
|
||||
context->playback->BackWard = 0;
|
||||
@@ -601,6 +608,7 @@ static int32_t PlaybackSlowMotion(Context_t *context, int *speed)
|
||||
{
|
||||
if (context->playback->isPaused)
|
||||
PlaybackContinue(context);
|
||||
|
||||
switch (*speed)
|
||||
{
|
||||
case 2:
|
||||
@@ -613,7 +621,9 @@ static int32_t PlaybackSlowMotion(Context_t *context, int *speed)
|
||||
context->playback->SlowMotion = 8;
|
||||
break;
|
||||
}
|
||||
|
||||
playback_printf(20, "SlowMotion: %d x {%d}\n", *speed, context->playback->SlowMotion);
|
||||
|
||||
context->output->Command(context, OUTPUT_SLOWMOTION, NULL);
|
||||
}
|
||||
else
|
||||
@@ -726,6 +736,7 @@ static int32_t PlaybackLength(Context_t *context, int64_t *length)
|
||||
}
|
||||
|
||||
playback_printf(20, "exiting with value %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -753,7 +764,6 @@ static int32_t PlaybackSwitchAudio(Context_t *context, int32_t *track)
|
||||
|
||||
if (nextrackid != curtrackid)
|
||||
{
|
||||
|
||||
//PlaybackPause(context);
|
||||
if (context->output && context->output->audio)
|
||||
{
|
||||
@@ -774,6 +784,7 @@ static int32_t PlaybackSwitchAudio(Context_t *context, int32_t *track)
|
||||
}
|
||||
|
||||
playback_printf(10, "exiting with value %d\n", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -860,7 +871,6 @@ static int32_t Command(Context_t *context, PlaybackCmd_t command, void *argument
|
||||
|
||||
playback_printf(20, "Command %d\n", command);
|
||||
|
||||
|
||||
switch (command)
|
||||
{
|
||||
case PLAYBACK_OPEN:
|
||||
@@ -898,6 +908,11 @@ static int32_t Command(Context_t *context, PlaybackCmd_t command, void *argument
|
||||
ret = PlaybackTerminate(context);
|
||||
break;
|
||||
}
|
||||
case PLAYBACK_FASTFORWARD:
|
||||
{
|
||||
ret = PlaybackFastForward(context, (int *)argument);
|
||||
break;
|
||||
}
|
||||
case PLAYBACK_SEEK:
|
||||
{
|
||||
ret = PlaybackSeek(context, (int64_t *)argument, 0);
|
||||
@@ -943,11 +958,6 @@ static int32_t Command(Context_t *context, PlaybackCmd_t command, void *argument
|
||||
ret = PlaybackFastBackward(context, (int *)argument);
|
||||
break;
|
||||
}
|
||||
case PLAYBACK_FASTFORWARD:
|
||||
{
|
||||
ret = PlaybackFastForward(context, (int *)argument);
|
||||
break;
|
||||
}
|
||||
case PLAYBACK_GET_FRAME_COUNT:
|
||||
{
|
||||
ret = PlaybackGetFrameCount(context, (uint64_t *)argument);
|
||||
|
Reference in New Issue
Block a user