mirror of
https://github.com/tuxbox-neutrino/libstb-hal.git
synced 2025-08-27 15:33:00 +02:00
libeplayer/container_ffmpeg: switch to ffmpeg 2.0 API
This commit is contained in:
@@ -435,7 +435,7 @@ static void FFMPEGThread(Context_t * context)
|
|||||||
swr = NULL;
|
swr = NULL;
|
||||||
}
|
}
|
||||||
if (decoded_frame) {
|
if (decoded_frame) {
|
||||||
avcodec_free_frame(&decoded_frame);
|
av_frame_free(&decoded_frame);
|
||||||
decoded_frame = NULL;
|
decoded_frame = NULL;
|
||||||
}
|
}
|
||||||
context->output->Command(context, OUTPUT_CLEAR, NULL);
|
context->output->Command(context, OUTPUT_CLEAR, NULL);
|
||||||
@@ -455,7 +455,7 @@ static void FFMPEGThread(Context_t * context)
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
avcodec_get_frame_defaults(decoded_frame);
|
av_frame_unref(decoded_frame);
|
||||||
|
|
||||||
int len = avcodec_decode_audio4(c, decoded_frame, &got_frame, &packet);
|
int len = avcodec_decode_audio4(c, decoded_frame, &got_frame, &packet);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
@@ -635,7 +635,7 @@ static void FFMPEGThread(Context_t * context)
|
|||||||
if (swr)
|
if (swr)
|
||||||
swr_free(&swr);
|
swr_free(&swr);
|
||||||
if (decoded_frame)
|
if (decoded_frame)
|
||||||
avcodec_free_frame(&decoded_frame);
|
av_frame_free(&decoded_frame);
|
||||||
|
|
||||||
if (context->playback)
|
if (context->playback)
|
||||||
context->playback->abortPlayback = 1;
|
context->playback->abortPlayback = 1;
|
||||||
|
@@ -125,8 +125,7 @@ static int prepareClipPlay(int uNoOfChannels, int uSampleRate,
|
|||||||
|
|
||||||
memcpy(lpcm_prv, clpcm_prv, sizeof(lpcm_prv));
|
memcpy(lpcm_prv, clpcm_prv, sizeof(lpcm_prv));
|
||||||
|
|
||||||
//figure out size of subframe
|
// figure out size of subframe and set up sample rate
|
||||||
//and set up sample rate
|
|
||||||
switch (uSampleRate) {
|
switch (uSampleRate) {
|
||||||
case 48000:
|
case 48000:
|
||||||
SubFrameLen = 40;
|
SubFrameLen = 40;
|
||||||
@@ -172,8 +171,7 @@ static int prepareClipPlay(int uNoOfChannels, int uSampleRate,
|
|||||||
case 16:
|
case 16:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
printf("inappropriate bits per sample (%d) - must be 16 or 24\n",
|
printf("inappropriate bits per sample (%d) - must be 16 or 24\n", uBitsPerSample);
|
||||||
uBitsPerSample);
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,16 +238,12 @@ static int writeData(void *_call)
|
|||||||
}
|
}
|
||||||
//get first PES's worth
|
//get first PES's worth
|
||||||
if (breakBufferFillSize > 0) {
|
if (breakBufferFillSize > 0) {
|
||||||
memcpy(injectBuffer, breakBuffer,
|
memcpy(injectBuffer, breakBuffer, sizeof(unsigned char) * breakBufferFillSize);
|
||||||
sizeof(unsigned char) * breakBufferFillSize);
|
memcpy(&injectBuffer[breakBufferFillSize], &buffer[pos], sizeof(unsigned char) * (SubFrameLen - breakBufferFillSize));
|
||||||
memcpy(&injectBuffer[breakBufferFillSize], &buffer[pos],
|
|
||||||
sizeof(unsigned char) * (SubFrameLen -
|
|
||||||
breakBufferFillSize));
|
|
||||||
pos += (SubFrameLen - breakBufferFillSize);
|
pos += (SubFrameLen - breakBufferFillSize);
|
||||||
breakBufferFillSize = 0;
|
breakBufferFillSize = 0;
|
||||||
} else {
|
} else {
|
||||||
memcpy(injectBuffer, &buffer[pos],
|
memcpy(injectBuffer, &buffer[pos], sizeof(unsigned char) * SubFrameLen);
|
||||||
sizeof(unsigned char) * SubFrameLen);
|
|
||||||
pos += SubFrameLen;
|
pos += SubFrameLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -291,9 +285,7 @@ static int writeData(void *_call)
|
|||||||
//increment err... subframe count?
|
//increment err... subframe count?
|
||||||
lpcm_prv[1] = ((lpcm_prv[1] + SubFramesPerPES) & 0x1F);
|
lpcm_prv[1] = ((lpcm_prv[1] + SubFramesPerPES) & 0x1F);
|
||||||
|
|
||||||
iov[0].iov_len =
|
iov[0].iov_len = InsertPesHeader(PesHeader, iov[1].iov_len + iov[2].iov_len, PCM_PES_START_CODE, call->Pts, 0);
|
||||||
InsertPesHeader(PesHeader, iov[1].iov_len + iov[2].iov_len,
|
|
||||||
PCM_PES_START_CODE, call->Pts, 0);
|
|
||||||
int len = writev(call->fd, iov, 3);
|
int len = writev(call->fd, iov, 3);
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user