* Automatic whitespace cleanup.

* media_decode_info member was never used.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32015 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Stephan Aßmus 2009-07-31 13:04:14 +00:00
parent c6906c2832
commit 3ae83fe3c7
2 changed files with 33 additions and 33 deletions

View File

@ -60,7 +60,6 @@ static long profileCounter = 0;
AVCodecDecoder::AVCodecDecoder() AVCodecDecoder::AVCodecDecoder()
: :
fHeader(), fHeader(),
fInfo(),
fInputFormat(), fInputFormat(),
fOutputVideoFormat(), fOutputVideoFormat(),
fFrame(0), fFrame(0),
@ -110,7 +109,7 @@ AVCodecDecoder::~AVCodecDecoder()
free(fOutputPicture); free(fOutputPicture);
free(fInputPicture); free(fInputPicture);
free(fContext); free(fContext);
delete[] fExtraData; delete[] fExtraData;
delete[] fOutputBuffer; delete[] fOutputBuffer;
} }
@ -132,7 +131,7 @@ AVCodecDecoder::Setup(media_format* ioEncodedFormat, const void* infoBuffer,
if (ioEncodedFormat->type != B_MEDIA_ENCODED_AUDIO if (ioEncodedFormat->type != B_MEDIA_ENCODED_AUDIO
&& ioEncodedFormat->type != B_MEDIA_ENCODED_VIDEO) && ioEncodedFormat->type != B_MEDIA_ENCODED_VIDEO)
return B_ERROR; return B_ERROR;
fIsAudio = (ioEncodedFormat->type == B_MEDIA_ENCODED_AUDIO); fIsAudio = (ioEncodedFormat->type == B_MEDIA_ENCODED_AUDIO);
TRACE("[%c] AVCodecDecoder::Setup()\n", fIsAudio?('a'):('v')); TRACE("[%c] AVCodecDecoder::Setup()\n", fIsAudio?('a'):('v'));
@ -155,7 +154,7 @@ AVCodecDecoder::Setup(media_format* ioEncodedFormat, const void* infoBuffer,
for (int32 i = 0; gCodecTable[i].id; i++) { for (int32 i = 0; gCodecTable[i].id; i++) {
fCodecIndexInTable = i; fCodecIndexInTable = i;
uint64 cid; uint64 cid;
if (BMediaFormats().GetCodeFor(*ioEncodedFormat, if (BMediaFormats().GetCodeFor(*ioEncodedFormat,
gCodecTable[i].family, &descr) == B_OK gCodecTable[i].family, &descr) == B_OK
&& gCodecTable[i].type == ioEncodedFormat->type) { && gCodecTable[i].type == ioEncodedFormat->type) {
@ -204,7 +203,7 @@ AVCodecDecoder::Setup(media_format* ioEncodedFormat, const void* infoBuffer,
// Special case extra data in B_WAV_FORMAT_FAMILY // Special case extra data in B_WAV_FORMAT_FAMILY
const wave_format_ex* waveFormatData const wave_format_ex* waveFormatData
= (const wave_format_ex*)infoBuffer; = (const wave_format_ex*)infoBuffer;
size_t waveFormatSize = infoSize; size_t waveFormatSize = infoSize;
if (waveFormatData != NULL && waveFormatSize > 0) { if (waveFormatData != NULL && waveFormatSize > 0) {
fBlockAlign = waveFormatData->block_align; fBlockAlign = waveFormatData->block_align;
@ -376,7 +375,7 @@ AVCodecDecoder::_NegotiateAudioOutputFormat(media_format* inOutFormat)
fChunkBufferSize = 0; fChunkBufferSize = 0;
fOutputBufferOffset = 0; fOutputBufferOffset = 0;
fOutputBufferSize = 0; fOutputBufferSize = 0;
inOutFormat->require_flags = 0; inOutFormat->require_flags = 0;
inOutFormat->deny_flags = B_MEDIA_MAUI_UNDEFINED_FLAGS; inOutFormat->deny_flags = B_MEDIA_MAUI_UNDEFINED_FLAGS;
@ -400,9 +399,9 @@ AVCodecDecoder::_NegotiateVideoOutputFormat(media_format* inOutFormat)
fContext->height = fOutputVideoFormat.display.line_count; fContext->height = fOutputVideoFormat.display.line_count;
// fContext->frame_rate = (int)(fOutputVideoFormat.field_rate // fContext->frame_rate = (int)(fOutputVideoFormat.field_rate
// * fContext->frame_rate_base); // * fContext->frame_rate_base);
fOutputFrameRate = fOutputVideoFormat.field_rate; fOutputFrameRate = fOutputVideoFormat.field_rate;
fContext->extradata = (uint8_t*)fExtraData; fContext->extradata = (uint8_t*)fExtraData;
fContext->extradata_size = fExtraDataSize; fContext->extradata_size = fExtraDataSize;
@ -470,7 +469,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;
#ifdef TRACE_AV_CODEC #ifdef TRACE_AV_CODEC
char buffer[1024]; char buffer[1024];
string_for_format(*inOutFormat, buffer, sizeof(buffer)); string_for_format(*inOutFormat, buffer, sizeof(buffer));
TRACE("[v] outFormat = %s\n", buffer); TRACE("[v] outFormat = %s\n", buffer);
@ -501,7 +500,7 @@ AVCodecDecoder::_DecodeAudio(void* outBuffer, int64* outFrameCount,
fChunkBufferSize); fChunkBufferSize);
fChunkBufferSize = 0; fChunkBufferSize = 0;
} }
if (fOutputBufferSize > 0) { if (fOutputBufferSize > 0) {
int32 frames = min_c(fOutputFrameCount - *outFrameCount, int32 frames = min_c(fOutputFrameCount - *outFrameCount,
fOutputBufferSize / fOutputFrameSize); fOutputBufferSize / fOutputFrameSize);
@ -554,7 +553,7 @@ AVCodecDecoder::_DecodeAudio(void* outBuffer, int64* outFrameCount,
fChunkBufferOffset += len; fChunkBufferOffset += len;
fChunkBufferSize -= len; fChunkBufferSize -= len;
fOutputBufferOffset = 0; fOutputBufferOffset = 0;
fOutputBufferSize = out_size; fOutputBufferSize = out_size;
} }
} }
fFrame += *outFrameCount; fFrame += *outFrameCount;
@ -602,7 +601,7 @@ AVCodecDecoder::_DecodeVideo(void* outBuffer, int64* outFrameCount,
mediaHeader->u.raw_video.first_active_line = 1; mediaHeader->u.raw_video.first_active_line = 1;
mediaHeader->u.raw_video.line_count mediaHeader->u.raw_video.line_count
= fOutputVideoFormat.display.line_count; = fOutputVideoFormat.display.line_count;
TRACE("[v] start_time=%02d:%02d.%02d field_sequence=%lu\n", TRACE("[v] start_time=%02d:%02d.%02d field_sequence=%lu\n",
int((mediaHeader->start_time / 60000000) % 60), int((mediaHeader->start_time / 60000000) % 60),
int((mediaHeader->start_time / 1000000) % 60), int((mediaHeader->start_time / 1000000) % 60),
@ -613,7 +612,7 @@ AVCodecDecoder::_DecodeVideo(void* outBuffer, int64* outFrameCount,
#if DO_PROFILING #if DO_PROFILING
bigtime_t startTime = system_time(); bigtime_t startTime = system_time();
#endif #endif
// NOTE: In the FFmpeg code example I've read, the length returned by // NOTE: In the FFmpeg code example I've read, the length returned by
// avcodec_decode_video() is completely ignored. Furthermore, the // avcodec_decode_video() is completely ignored. Furthermore, the
// packet buffers are supposed to contain complete frames only so we // packet buffers are supposed to contain complete frames only so we
@ -625,10 +624,12 @@ AVCodecDecoder::_DecodeVideo(void* outBuffer, int64* outFrameCount,
if (len < 0) { if (len < 0) {
TRACE("[v] AVCodecDecoder: error in decoding frame %lld: %d\n", TRACE("[v] AVCodecDecoder: error in decoding frame %lld: %d\n",
fFrame, len); fFrame, len);
// NOTE: An error from avcodec_decode_video() seems to be ignored
// in the ffplay sample code.
// return B_ERROR; // return B_ERROR;
} }
//TRACE("FFDEC: PTS = %d:%d:%d.%d - fContext->frame_number = %ld " //TRACE("FFDEC: PTS = %d:%d:%d.%d - fContext->frame_number = %ld "
// "fContext->frame_rate = %ld\n", (int)(fContext->pts / (60*60*1000000)), // "fContext->frame_rate = %ld\n", (int)(fContext->pts / (60*60*1000000)),
// (int)(fContext->pts / (60*1000000)), (int)(fContext->pts / (1000000)), // (int)(fContext->pts / (60*1000000)), (int)(fContext->pts / (1000000)),
@ -674,7 +675,7 @@ AVCodecDecoder::_DecodeVideo(void* outBuffer, int64* outFrameCount,
#endif #endif
// TRACE("ONE FRAME OUT !! len=%d size=%ld (%s)\n", len, size, // TRACE("ONE FRAME OUT !! len=%d size=%ld (%s)\n", len, size,
// pixfmt_to_string(fContext->pix_fmt)); // pixfmt_to_string(fContext->pix_fmt));
// Some decoders do not set pix_fmt until they have decoded 1 frame // Some decoders do not set pix_fmt until they have decoded 1 frame
if (fFormatConversionFunc == NULL) { if (fFormatConversionFunc == NULL) {
fFormatConversionFunc = resolve_colorspace( fFormatConversionFunc = resolve_colorspace(
@ -683,7 +684,7 @@ AVCodecDecoder::_DecodeVideo(void* outBuffer, int64* outFrameCount,
fOutputPicture->data[0] = (uint8_t*)outBuffer; fOutputPicture->data[0] = (uint8_t*)outBuffer;
fOutputPicture->linesize[0] fOutputPicture->linesize[0]
= fOutputVideoFormat.display.bytes_per_row; = fOutputVideoFormat.display.bytes_per_row;
if (fFormatConversionFunc != NULL) { if (fFormatConversionFunc != NULL) {
if (useDeinterlacedPicture) { if (useDeinterlacedPicture) {
AVFrame inputFrame; AVFrame inputFrame;
@ -695,7 +696,7 @@ AVCodecDecoder::_DecodeVideo(void* outBuffer, int64* outFrameCount,
inputFrame.linesize[1] = deinterlacedPicture.linesize[1]; inputFrame.linesize[1] = deinterlacedPicture.linesize[1];
inputFrame.linesize[2] = deinterlacedPicture.linesize[2]; inputFrame.linesize[2] = deinterlacedPicture.linesize[2];
inputFrame.linesize[3] = deinterlacedPicture.linesize[3]; inputFrame.linesize[3] = deinterlacedPicture.linesize[3];
(*fFormatConversionFunc)(&inputFrame, (*fFormatConversionFunc)(&inputFrame,
fOutputPicture, width, height); fOutputPicture, width, height);
} else { } else {
@ -709,7 +710,7 @@ AVCodecDecoder::_DecodeVideo(void* outBuffer, int64* outFrameCount,
dump_ffframe(fInputPicture, "ffpict"); dump_ffframe(fInputPicture, "ffpict");
// dump_ffframe(fOutputPicture, "opict"); // dump_ffframe(fOutputPicture, "opict");
#endif #endif
*outFrameCount = 1; *outFrameCount = 1;
fFrame++; fFrame++;
#if DO_PROFILING #if DO_PROFILING

View File

@ -23,17 +23,17 @@
class AVCodecDecoder : public Decoder { class AVCodecDecoder : public Decoder {
public: public:
AVCodecDecoder(); AVCodecDecoder();
virtual ~AVCodecDecoder(); virtual ~AVCodecDecoder();
virtual void GetCodecInfo(media_codec_info* mci); virtual void GetCodecInfo(media_codec_info* mci);
virtual status_t Setup(media_format* ioEncodedFormat, virtual status_t Setup(media_format* ioEncodedFormat,
const void* infoBuffer, size_t infoSize); const void* infoBuffer, size_t infoSize);
virtual status_t NegotiateOutputFormat( virtual status_t NegotiateOutputFormat(
media_format* inOutFormat); media_format* inOutFormat);
virtual status_t Decode(void* outBuffer, int64* outFrameCount, virtual status_t Decode(void* outBuffer, int64* outFrameCount,
media_header* mediaHeader, media_header* mediaHeader,
media_decode_info* info); media_decode_info* info);
@ -41,8 +41,8 @@ public:
virtual status_t Seek(uint32 seekTo, int64 seekFrame, virtual status_t Seek(uint32 seekTo, int64 seekFrame,
int64* frame, bigtime_t seekTime, int64* frame, bigtime_t seekTime,
bigtime_t* time); bigtime_t* time);
private: private:
status_t _NegotiateAudioOutputFormat( status_t _NegotiateAudioOutputFormat(
media_format* inOutFormat); media_format* inOutFormat);
@ -60,24 +60,23 @@ private:
media_header* mediaHeader, media_header* mediaHeader,
media_decode_info* info); media_decode_info* info);
media_header fHeader; media_header fHeader;
media_decode_info fInfo;
media_format fInputFormat; media_format fInputFormat;
media_raw_video_format fOutputVideoFormat; media_raw_video_format fOutputVideoFormat;
int64 fFrame; int64 fFrame;
bool fIsAudio; bool fIsAudio;
int fCodecIndexInTable; int fCodecIndexInTable;
// helps to find codecpretty // helps to find codecpretty
// FFmpeg related members // FFmpeg related members
AVCodec* fCodec; AVCodec* fCodec;
AVCodecContext* fContext; AVCodecContext* fContext;
AVFrame* fInputPicture; AVFrame* fInputPicture;
AVFrame* fOutputPicture; AVFrame* fOutputPicture;
bool fCodecInitDone; bool fCodecInitDone;
gfx_convert_func fFormatConversionFunc; gfx_convert_func fFormatConversionFunc;
@ -85,13 +84,13 @@ private:
char* fExtraData; char* fExtraData;
int fExtraDataSize; int fExtraDataSize;
int fBlockAlign; int fBlockAlign;
bigtime_t fStartTime; bigtime_t fStartTime;
int32 fOutputFrameCount; int32 fOutputFrameCount;
float fOutputFrameRate; float fOutputFrameRate;
int fOutputFrameSize; int fOutputFrameSize;
// sample size * channel count // sample size * channel count
const void* fChunkBuffer; const void* fChunkBuffer;
int32 fChunkBufferOffset; int32 fChunkBufferOffset;
size_t fChunkBufferSize; size_t fChunkBufferSize;