mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-26 15:02:58 +02:00
libeplayer: simplify writer/pcm
This commit is contained in:
@@ -5,6 +5,7 @@ CXXFLAGS = -Wall
|
||||
AM_CPPFLAGS = -I$(srcdir)/include
|
||||
AM_CPPFLAGS += -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE
|
||||
AM_CPPFLAGS += -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS
|
||||
AM_CPPFLAGS += -ggdb
|
||||
|
||||
libeplayer3_la_SOURCES = \
|
||||
container/container.cpp container/container_ffmpeg.cpp \
|
||||
|
@@ -340,7 +340,7 @@ static void *FFMPEGThread(void *arg)
|
||||
ffmpeg_printf(200, "packet_size %d - index %d\n", packet.size, pid);
|
||||
|
||||
if (videoTrack && (videoTrack->Id == pid)) {
|
||||
currentVideoPts = /* CHECK videoTrack->pts = */pts = calcPts(avContext, videoTrack->stream, packet.pts);
|
||||
currentVideoPts = pts = calcPts(avContext, videoTrack->stream, packet.pts);
|
||||
|
||||
ffmpeg_printf(200, "VideoTrack index = %d %lld\n", pid, currentVideoPts);
|
||||
|
||||
@@ -356,7 +356,7 @@ static void *FFMPEGThread(void *arg)
|
||||
} else if (audioTrack && (audioTrack->Id == pid)) {
|
||||
context->currentAudioPtsP = ¤tAudioPts; //FIXME, temporary workaround only
|
||||
if (!context->playback->BackWard) {
|
||||
currentAudioPts = /* CHECK audioTrack->pts = */pts = calcPts(avContext, audioTrack->stream, packet.pts);
|
||||
currentAudioPts = pts = calcPts(avContext, audioTrack->stream, packet.pts);
|
||||
|
||||
ffmpeg_printf(200, "AudioTrack index = %d\n", pid);
|
||||
avOut.pts = pts;
|
||||
|
Binary file not shown.
@@ -42,7 +42,6 @@ typedef struct Track_s {
|
||||
|
||||
/* length of track */
|
||||
int64_t duration;
|
||||
//CHECK int64_t pts;
|
||||
|
||||
/* context from ffmpeg */
|
||||
AVFormatContext *avfc;
|
||||
|
@@ -274,21 +274,12 @@ AVFrame *decoded_frame = NULL;
|
||||
int out_sample_rate = 44100;
|
||||
int out_channels = 2;
|
||||
uint64_t out_channel_layout = AV_CH_LAYOUT_STEREO;
|
||||
int restart_audio_resampling = 0;
|
||||
int restart_audio_resampling = 1;
|
||||
|
||||
static int reset()
|
||||
{
|
||||
initialHeader = 1;
|
||||
|
||||
if (swr) {
|
||||
swr_free(&swr);
|
||||
swr = NULL; //FIXME: Needed?
|
||||
}
|
||||
if (decoded_frame) {
|
||||
av_frame_free(&decoded_frame);
|
||||
decoded_frame = NULL; //FIXME: Needed?
|
||||
}
|
||||
|
||||
restart_audio_resampling = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -306,10 +297,16 @@ static int writeData(WriterAVCallData_t *call)
|
||||
|
||||
if (restart_audio_resampling) {
|
||||
restart_audio_resampling = 0;
|
||||
reset();
|
||||
initialHeader = 1;
|
||||
|
||||
call->context->output->Command(call->context, OUTPUT_CLEAR, NULL);
|
||||
call->context->output->Command(call->context, OUTPUT_PLAY, NULL);
|
||||
if (swr) {
|
||||
swr_free(&swr);
|
||||
swr = NULL; //FIXME: Needed?
|
||||
}
|
||||
if (decoded_frame) {
|
||||
av_frame_free(&decoded_frame);
|
||||
decoded_frame = NULL; //FIXME: Needed?
|
||||
}
|
||||
|
||||
AVCodec *codec = avcodec_find_decoder(c->codec_id);
|
||||
|
||||
@@ -395,7 +392,7 @@ static int writeData(WriterAVCallData_t *call)
|
||||
int64_t next_out_pts = av_rescale(swr_next_pts(swr, next_in_pts),
|
||||
call->stream->time_base.den,
|
||||
call->stream->time_base.num * (int64_t) out_sample_rate * c->sample_rate);
|
||||
*(call->context->currentAudioPtsP) = /* audioTrack->pts = */ pts = calcPts(call->avfc, call->stream, next_out_pts);
|
||||
*(call->context->currentAudioPtsP) = pts = calcPts(call->avfc, call->stream, next_out_pts);
|
||||
out_samples = swr_convert(swr, &output, out_samples, (const uint8_t **) &decoded_frame->data[0], in_samples);
|
||||
|
||||
uSampleRate = out_sample_rate;
|
||||
|
Reference in New Issue
Block a user