mirror of
https://github.com/tuxbox-fork-migrations/recycled-ni-libstb-hal.git
synced 2025-08-27 07:22:44 +02:00
Improve seeks on playback with multi AV context - when option
Origin commit data
------------------
Branch: master
Commit: 8755785769
Author: samsamsam <samsamsam@o2.pl>
Date: 2019-01-22 (Tue, 22 Jan 2019)
------------------
No further description and justification available within origin commit message!
------------------
This commit was generated by Migit
This commit is contained in:
@@ -546,6 +546,8 @@ static void FFMPEGThread(Context_t *context)
|
|||||||
int64_t lastVideoDts = -1;
|
int64_t lastVideoDts = -1;
|
||||||
int64_t lastAudioDts = -1;
|
int64_t lastAudioDts = -1;
|
||||||
|
|
||||||
|
int64_t multiContextLastPts[IPTV_AV_CONTEXT_MAX_NUM] = {INVALID_PTS_VALUE, INVALID_PTS_VALUE};
|
||||||
|
|
||||||
int64_t showtime = 0;
|
int64_t showtime = 0;
|
||||||
int64_t bofcount = 0;
|
int64_t bofcount = 0;
|
||||||
AudioVideoOut_t avOut;
|
AudioVideoOut_t avOut;
|
||||||
@@ -677,6 +679,7 @@ static void FFMPEGThread(Context_t *context)
|
|||||||
uint32_t i = 0;
|
uint32_t i = 0;
|
||||||
for (; i < IPTV_AV_CONTEXT_MAX_NUM; i += 1)
|
for (; i < IPTV_AV_CONTEXT_MAX_NUM; i += 1)
|
||||||
{
|
{
|
||||||
|
multiContextLastPts[i] = INVALID_PTS_VALUE;
|
||||||
if (NULL != avContextTab[i])
|
if (NULL != avContextTab[i])
|
||||||
{
|
{
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
@@ -740,12 +743,31 @@ static void FFMPEGThread(Context_t *context)
|
|||||||
{
|
{
|
||||||
if (NULL != avContextTab[1])
|
if (NULL != avContextTab[1])
|
||||||
{
|
{
|
||||||
cAVIdx = currentVideoPts <= currentAudioPts ? 0 : 1;
|
if (prev_seek_time_sec >= 0)
|
||||||
if (1 == cAVIdx && prev_seek_time_sec >= 0)
|
|
||||||
{
|
{
|
||||||
avformat_seek_file(avContextTab[1], -1, (currentVideoPts / 90000) * AV_TIME_BASE - AV_TIME_BASE, (currentVideoPts / 90000) * AV_TIME_BASE, (currentVideoPts / 90000) * AV_TIME_BASE + AV_TIME_BASE, 0);
|
if (multiContextLastPts[0] != INVALID_PTS_VALUE)
|
||||||
|
{
|
||||||
|
int64_t target = av_rescale(multiContextLastPts[0], AV_TIME_BASE, 90000);
|
||||||
|
avformat_seek_file(avContextTab[1], -1, INT64_MIN, target, INT64_MAX, 0);
|
||||||
prev_seek_time_sec = -1;
|
prev_seek_time_sec = -1;
|
||||||
wrapped_avcodec_flush_buffers(1);
|
wrapped_avcodec_flush_buffers(1);
|
||||||
|
cAVIdx = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cAVIdx = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (multiContextLastPts[0] != INVALID_PTS_VALUE && multiContextLastPts[1] != INVALID_PTS_VALUE)
|
||||||
|
{
|
||||||
|
cAVIdx = multiContextLastPts[0] < multiContextLastPts[1] ? 0 : 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cAVIdx = !cAVIdx;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -766,6 +788,9 @@ static void FFMPEGThread(Context_t *context)
|
|||||||
|
|
||||||
int32_t pid = avContextTab[cAVIdx]->streams[packet.stream_index]->id;
|
int32_t pid = avContextTab[cAVIdx]->streams[packet.stream_index]->id;
|
||||||
|
|
||||||
|
multiContextLastPts[cAVIdx] = calcPts(cAVIdx, avContextTab[cAVIdx]->streams[packet.stream_index], packet.pts);
|
||||||
|
ffmpeg_printf(200, "Ctx %d PTS: %"PRId64" PTS[1] %"PRId64"\n", cAVIdx, multiContextLastPts[cAVIdx], multiContextLastPts[1]);
|
||||||
|
|
||||||
reset_finish_timeout();
|
reset_finish_timeout();
|
||||||
|
|
||||||
if (avContextTab[cAVIdx]->streams[packet.stream_index]->discard != AVDISCARD_ALL)
|
if (avContextTab[cAVIdx]->streams[packet.stream_index]->discard != AVDISCARD_ALL)
|
||||||
@@ -2067,7 +2092,8 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
|
|||||||
{
|
{
|
||||||
case AVMEDIA_TYPE_VIDEO:
|
case AVMEDIA_TYPE_VIDEO:
|
||||||
ffmpeg_printf(10, "CODEC_TYPE_VIDEO %d\n", get_codecpar(stream)->codec_type);
|
ffmpeg_printf(10, "CODEC_TYPE_VIDEO %d\n", get_codecpar(stream)->codec_type);
|
||||||
stream->discard = AVDISCARD_ALL; /* by default we discard all video streams */
|
// do not discard any stream from second context
|
||||||
|
stream->discard = 0 == cAVIdx ? AVDISCARD_ALL : AVDISCARD_DEFAULT; /* by default we discard all video streams */
|
||||||
|
|
||||||
if (encoding != NULL)
|
if (encoding != NULL)
|
||||||
{
|
{
|
||||||
@@ -2169,7 +2195,8 @@ int32_t container_ffmpeg_update_tracks(Context_t *context, char *filename, int32
|
|||||||
break;
|
break;
|
||||||
case AVMEDIA_TYPE_AUDIO:
|
case AVMEDIA_TYPE_AUDIO:
|
||||||
ffmpeg_printf(10, "CODEC_TYPE_AUDIO %d\n", get_codecpar(stream)->codec_type);
|
ffmpeg_printf(10, "CODEC_TYPE_AUDIO %d\n", get_codecpar(stream)->codec_type);
|
||||||
stream->discard = AVDISCARD_ALL;
|
// do not discard any stream from second context
|
||||||
|
stream->discard = 0 == cAVIdx ? AVDISCARD_ALL : AVDISCARD_DEFAULT;
|
||||||
|
|
||||||
if (encoding != NULL)
|
if (encoding != NULL)
|
||||||
{
|
{
|
||||||
@@ -3037,11 +3064,15 @@ static int32_t container_ffmpeg_switch_audio(Context_t *context, int32_t *arg __
|
|||||||
{
|
{
|
||||||
int32_t i;
|
int32_t i;
|
||||||
for (i = 0; i < TrackCount; ++i)
|
for (i = 0; i < TrackCount; ++i)
|
||||||
|
{
|
||||||
|
// do not discard any stream from second context
|
||||||
|
if (Tracks[i].AVIdx == 0)
|
||||||
{
|
{
|
||||||
((AVStream *)Tracks[i].stream)->discard = Tracks[i].Id == *arg ? AVDISCARD_DEFAULT : AVDISCARD_ALL;
|
((AVStream *)Tracks[i].stream)->discard = Tracks[i].Id == *arg ? AVDISCARD_DEFAULT : AVDISCARD_ALL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
releaseMutex(__FILE__, __FUNCTION__, __LINE__);
|
releaseMutex(__FILE__, __FUNCTION__, __LINE__);
|
||||||
|
|
||||||
/* Hellmaster1024: nothing to do here! */
|
/* Hellmaster1024: nothing to do here! */
|
||||||
|
@@ -695,7 +695,7 @@ int main(int argc, char *argv[])
|
|||||||
memset(argvBuff, '\0', sizeof(argvBuff));
|
memset(argvBuff, '\0', sizeof(argvBuff));
|
||||||
int commandRetVal = -1;
|
int commandRetVal = -1;
|
||||||
/* inform client that we can handle additional commands */
|
/* inform client that we can handle additional commands */
|
||||||
fprintf(stderr, "{\"EPLAYER3_EXTENDED\":{\"version\":%d}}\n", 50);
|
fprintf(stderr, "{\"EPLAYER3_EXTENDED\":{\"version\":%d}}\n", 51);
|
||||||
|
|
||||||
PlayFiles_t playbackFiles;
|
PlayFiles_t playbackFiles;
|
||||||
memset(&playbackFiles, 0x00, sizeof(playbackFiles));
|
memset(&playbackFiles, 0x00, sizeof(playbackFiles));
|
||||||
|
Reference in New Issue
Block a user