FFMPEG Plugin: Code styles, typos and code deduplication.
- Kudos to stippi for taking the time pointing those out :) http://www.freelists.org/post/haiku-commits/haiku-hrev47576-srcaddonsmediapluginsffmpeg,1 - No functional change intended. Signed-off-by: Colin Günther <[email protected]>
This commit is contained in:
@@ -254,9 +254,7 @@ AVCodecDecoder::SeekedTo(int64 frame, bigtime_t time)
|
|||||||
// Reset the FFmpeg codec to flush buffers, so we keep the sync
|
// Reset the FFmpeg codec to flush buffers, so we keep the sync
|
||||||
if (fCodecInitDone) {
|
if (fCodecInitDone) {
|
||||||
avcodec_flush_buffers(fContext);
|
avcodec_flush_buffers(fContext);
|
||||||
av_init_packet(&fTempPacket);
|
_ResetTempPacket();
|
||||||
fTempPacket.size = 0;
|
|
||||||
fTempPacket.data = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flush internal buffers as well.
|
// Flush internal buffers as well.
|
||||||
@@ -318,6 +316,15 @@ AVCodecDecoder::Decode(void* outBuffer, int64* outFrameCount,
|
|||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
AVCodecDecoder::_ResetTempPacket()
|
||||||
|
{
|
||||||
|
av_init_packet(&fTempPacket);
|
||||||
|
fTempPacket.size = 0;
|
||||||
|
fTempPacket.data = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
AVCodecDecoder::_NegotiateAudioOutputFormat(media_format* inOutFormat)
|
AVCodecDecoder::_NegotiateAudioOutputFormat(media_format* inOutFormat)
|
||||||
{
|
{
|
||||||
@@ -404,7 +411,7 @@ AVCodecDecoder::_NegotiateAudioOutputFormat(media_format* inOutFormat)
|
|||||||
fOutputBufferOffset = 0;
|
fOutputBufferOffset = 0;
|
||||||
fOutputBufferSize = 0;
|
fOutputBufferSize = 0;
|
||||||
|
|
||||||
av_init_packet(&fTempPacket);
|
_ResetTempPacket();
|
||||||
|
|
||||||
inOutFormat->require_flags = 0;
|
inOutFormat->require_flags = 0;
|
||||||
inOutFormat->deny_flags = B_MEDIA_MAUI_UNDEFINED_FLAGS;
|
inOutFormat->deny_flags = B_MEDIA_MAUI_UNDEFINED_FLAGS;
|
||||||
@@ -435,7 +442,9 @@ AVCodecDecoder::_NegotiateVideoOutputFormat(media_format* inOutFormat)
|
|||||||
fContext->extradata = (uint8_t*)fExtraData;
|
fContext->extradata = (uint8_t*)fExtraData;
|
||||||
fContext->extradata_size = fExtraDataSize;
|
fContext->extradata_size = fExtraDataSize;
|
||||||
|
|
||||||
if (fCodec->capabilities & CODEC_CAP_TRUNCATED) {
|
bool codecCanHandleIncompleteFrames
|
||||||
|
= (fCodec->capabilities & CODEC_CAP_TRUNCATED) != 0;
|
||||||
|
if (codecCanHandleIncompleteFrames) {
|
||||||
// Expect and handle video frames to be splitted across consecutive
|
// Expect and handle video frames to be splitted across consecutive
|
||||||
// data chunks.
|
// data chunks.
|
||||||
fContext->flags |= CODEC_FLAG_TRUNCATED;
|
fContext->flags |= CODEC_FLAG_TRUNCATED;
|
||||||
@@ -522,9 +531,7 @@ AVCodecDecoder::_NegotiateVideoOutputFormat(media_format* inOutFormat)
|
|||||||
inOutFormat->require_flags = 0;
|
inOutFormat->require_flags = 0;
|
||||||
inOutFormat->deny_flags = B_MEDIA_MAUI_UNDEFINED_FLAGS;
|
inOutFormat->deny_flags = B_MEDIA_MAUI_UNDEFINED_FLAGS;
|
||||||
|
|
||||||
av_init_packet(&fTempPacket);
|
_ResetTempPacket();
|
||||||
fTempPacket.size = 0;
|
|
||||||
fTempPacket.data = NULL;
|
|
||||||
|
|
||||||
#ifdef TRACE_AV_CODEC
|
#ifdef TRACE_AV_CODEC
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
@@ -885,7 +892,7 @@ AVCodecDecoder::_DecodeNextVideoFrame()
|
|||||||
updated fHeader.
|
updated fHeader.
|
||||||
4. There will be at maximumn only one decoded video frame in our cache
|
4. There will be at maximumn only one decoded video frame in our cache
|
||||||
at any single point in time. Otherwise you couldn't tell to which
|
at any single point in time. Otherwise you couldn't tell to which
|
||||||
cached decoded video frame te properties in fHeader relate to.
|
cached decoded video frame the properties in fHeader relate to.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
AVCodecDecoder::_UpdateMediaHeaderForVideoFrame()
|
AVCodecDecoder::_UpdateMediaHeaderForVideoFrame()
|
||||||
|
|||||||
@@ -48,6 +48,8 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void _ResetTempPacket();
|
||||||
|
|
||||||
status_t _NegotiateAudioOutputFormat(
|
status_t _NegotiateAudioOutputFormat(
|
||||||
media_format* inOutFormat);
|
media_format* inOutFormat);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user