mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 11:36:13 +00:00
Some macro removed
This commit is contained in:
parent
023d385af8
commit
6462201aac
3 changed files with 52 additions and 58 deletions
|
@ -18,8 +18,6 @@ extern "C"
|
|||
|
||||
extern Module cellAdec;
|
||||
|
||||
#define ADEC_ERROR(...) { cellAdec.Error(__VA_ARGS__); Emu.Pause(); return; } // only for decoder thread
|
||||
|
||||
AudioDecoder::AudioDecoder(s32 type, u32 addr, u32 size, vm::ptr<CellAdecCbMsg> func, u32 arg)
|
||||
: type(type)
|
||||
, memAddr(addr)
|
||||
|
@ -58,28 +56,28 @@ AudioDecoder::AudioDecoder(s32 type, u32 addr, u32 size, vm::ptr<CellAdecCbMsg>
|
|||
}
|
||||
default:
|
||||
{
|
||||
ADEC_ERROR("AudioDecoder(): unknown type (0x%x)", type);
|
||||
throw EXCEPTION("Unknown type (0x%x)", type);
|
||||
}
|
||||
}
|
||||
|
||||
if (!codec)
|
||||
{
|
||||
ADEC_ERROR("AudioDecoder(): avcodec_find_decoder() failed");
|
||||
throw EXCEPTION("avcodec_find_decoder() failed");
|
||||
}
|
||||
if (!input_format)
|
||||
{
|
||||
ADEC_ERROR("AudioDecoder(): av_find_input_format() failed");
|
||||
throw EXCEPTION("av_find_input_format() failed");
|
||||
}
|
||||
fmt = avformat_alloc_context();
|
||||
if (!fmt)
|
||||
{
|
||||
ADEC_ERROR("AudioDecoder(): avformat_alloc_context() failed");
|
||||
throw EXCEPTION("avformat_alloc_context() failed");
|
||||
}
|
||||
io_buf = (u8*)av_malloc(4096);
|
||||
fmt->pb = avio_alloc_context(io_buf, 256, 0, this, adecRead, NULL, NULL);
|
||||
if (!fmt->pb)
|
||||
{
|
||||
ADEC_ERROR("AudioDecoder(): avio_alloc_context() failed");
|
||||
throw EXCEPTION("avio_alloc_context() failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -330,7 +328,7 @@ void adecOpen(u32 adec_id) // TODO: call from the constructor
|
|||
err = avformat_open_input(&adec.fmt, NULL, adec.input_format, &opts);
|
||||
if (err || opts)
|
||||
{
|
||||
ADEC_ERROR("adecDecodeAu: avformat_open_input() failed (err=0x%x, opts=%d)", err, opts ? 1 : 0);
|
||||
throw EXCEPTION("avformat_open_input() failed (err=0x%x, opts=%d)", err, opts ? 1 : 0);
|
||||
}
|
||||
//err = avformat_find_stream_info(adec.fmt, NULL);
|
||||
//if (err || !adec.fmt->nb_streams)
|
||||
|
@ -339,7 +337,7 @@ void adecOpen(u32 adec_id) // TODO: call from the constructor
|
|||
//}
|
||||
if (!avformat_new_stream(adec.fmt, adec.codec))
|
||||
{
|
||||
ADEC_ERROR("adecDecodeAu: avformat_new_stream() failed");
|
||||
throw EXCEPTION("avformat_new_stream() failed");
|
||||
}
|
||||
adec.ctx = adec.fmt->streams[0]->codec; // TODO: check data
|
||||
|
||||
|
@ -352,7 +350,7 @@ void adecOpen(u32 adec_id) // TODO: call from the constructor
|
|||
}
|
||||
if (err || opts)
|
||||
{
|
||||
ADEC_ERROR("adecDecodeAu: avcodec_open2() failed (err=0x%x, opts=%d)", err, opts ? 1 : 0);
|
||||
throw EXCEPTION("avcodec_open2() failed (err=0x%x, opts=%d)", err, opts ? 1 : 0);
|
||||
}
|
||||
adec.just_started = false;
|
||||
}
|
||||
|
@ -396,7 +394,7 @@ void adecOpen(u32 adec_id) // TODO: call from the constructor
|
|||
|
||||
if (!frame.data)
|
||||
{
|
||||
ADEC_ERROR("adecDecodeAu: av_frame_alloc() failed");
|
||||
throw EXCEPTION("av_frame_alloc() failed");
|
||||
}
|
||||
|
||||
int got_frame = 0;
|
||||
|
@ -430,7 +428,7 @@ void adecOpen(u32 adec_id) // TODO: call from the constructor
|
|||
case AV_SAMPLE_FMT_S16P: break;
|
||||
default:
|
||||
{
|
||||
ADEC_ERROR("adecDecodeAu: unsupported frame format(%d)", frame.data->format);
|
||||
throw EXCEPTION("Unsupported frame format(%d)", frame.data->format);
|
||||
}
|
||||
}
|
||||
frame.auAddr = task.au.addr;
|
||||
|
@ -460,7 +458,7 @@ void adecOpen(u32 adec_id) // TODO: call from the constructor
|
|||
|
||||
default:
|
||||
{
|
||||
ADEC_ERROR("AudioDecoder thread error: unknown task(%d)", task.type);
|
||||
throw EXCEPTION("Unknown task(%d)", task.type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
extern Module cellDmux;
|
||||
|
||||
#define DMUX_ERROR(...) { cellDmux.Error(__VA_ARGS__); Emu.Pause(); return; } // only for demuxer thread
|
||||
|
||||
PesHeader::PesHeader(DemuxerStream& stream)
|
||||
: pts(CODEC_TS_INVALID)
|
||||
, dts(CODEC_TS_INVALID)
|
||||
|
@ -21,15 +19,15 @@ PesHeader::PesHeader(DemuxerStream& stream)
|
|||
u16 header;
|
||||
if (!stream.get(header))
|
||||
{
|
||||
DMUX_ERROR("PesHeader(): end of stream (header)");
|
||||
throw EXCEPTION("End of stream (header)");
|
||||
}
|
||||
if (!stream.get(size))
|
||||
{
|
||||
DMUX_ERROR("PesHeader(): end of stream (size)");
|
||||
throw EXCEPTION("End of stream (size)");
|
||||
}
|
||||
if (!stream.check(size))
|
||||
{
|
||||
DMUX_ERROR("PesHeader(): end of stream (size=%d)", size);
|
||||
throw EXCEPTION("End of stream (size=%d)", size);
|
||||
}
|
||||
|
||||
u8 pos = 0;
|
||||
|
@ -360,7 +358,7 @@ void dmuxOpen(u32 dmux_id) // TODO: call from the constructor
|
|||
{
|
||||
if (!stream.check(14))
|
||||
{
|
||||
DMUX_ERROR("End of stream (PACK_START_CODE)");
|
||||
throw EXCEPTION("End of stream (PACK_START_CODE)");
|
||||
}
|
||||
stream.skip(14);
|
||||
break;
|
||||
|
@ -370,7 +368,7 @@ void dmuxOpen(u32 dmux_id) // TODO: call from the constructor
|
|||
{
|
||||
if (!stream.check(18))
|
||||
{
|
||||
DMUX_ERROR("End of stream (SYSTEM_HEADER_START_CODE)");
|
||||
throw EXCEPTION("End of stream (SYSTEM_HEADER_START_CODE)");
|
||||
}
|
||||
stream.skip(18);
|
||||
break;
|
||||
|
@ -380,14 +378,14 @@ void dmuxOpen(u32 dmux_id) // TODO: call from the constructor
|
|||
{
|
||||
if (!stream.check(6))
|
||||
{
|
||||
DMUX_ERROR("End of stream (PADDING_STREAM)");
|
||||
throw EXCEPTION("End of stream (PADDING_STREAM)");
|
||||
}
|
||||
stream.skip(4);
|
||||
stream.get(len);
|
||||
|
||||
if (!stream.check(len))
|
||||
{
|
||||
DMUX_ERROR("End of stream (PADDING_STREAM, len=%d)", len);
|
||||
throw EXCEPTION("End of stream (PADDING_STREAM, len=%d)", len);
|
||||
}
|
||||
stream.skip(len);
|
||||
break;
|
||||
|
@ -397,7 +395,7 @@ void dmuxOpen(u32 dmux_id) // TODO: call from the constructor
|
|||
{
|
||||
if (!stream.check(6))
|
||||
{
|
||||
DMUX_ERROR("End of stream (PRIVATE_STREAM_2)");
|
||||
throw EXCEPTION("End of stream (PRIVATE_STREAM_2)");
|
||||
}
|
||||
stream.skip(4);
|
||||
stream.get(len);
|
||||
|
@ -406,7 +404,7 @@ void dmuxOpen(u32 dmux_id) // TODO: call from the constructor
|
|||
|
||||
if (!stream.check(len))
|
||||
{
|
||||
DMUX_ERROR("End of stream (PRIVATE_STREAM_2, len=%d)", len);
|
||||
throw EXCEPTION("End of stream (PRIVATE_STREAM_2, len=%d)", len);
|
||||
}
|
||||
stream.skip(len);
|
||||
break;
|
||||
|
@ -419,32 +417,32 @@ void dmuxOpen(u32 dmux_id) // TODO: call from the constructor
|
|||
|
||||
if (!stream.check(6))
|
||||
{
|
||||
DMUX_ERROR("End of stream (PRIVATE_STREAM_1)");
|
||||
throw EXCEPTION("End of stream (PRIVATE_STREAM_1)");
|
||||
}
|
||||
stream.skip(4);
|
||||
stream.get(len);
|
||||
|
||||
if (!stream.check(len))
|
||||
{
|
||||
DMUX_ERROR("End of stream (PRIVATE_STREAM_1, len=%d)", len);
|
||||
throw EXCEPTION("End of stream (PRIVATE_STREAM_1, len=%d)", len);
|
||||
}
|
||||
|
||||
const PesHeader pes(stream);
|
||||
if (!pes.is_ok)
|
||||
{
|
||||
DMUX_ERROR("PesHeader error (PRIVATE_STREAM_1, len=%d)", len);
|
||||
throw EXCEPTION("PesHeader error (PRIVATE_STREAM_1, len=%d)", len);
|
||||
}
|
||||
|
||||
if (len < pes.size + 4)
|
||||
{
|
||||
DMUX_ERROR("End of block (PRIVATE_STREAM_1, PesHeader + fid_minor, len=%d)", len);
|
||||
throw EXCEPTION("End of block (PRIVATE_STREAM_1, PesHeader + fid_minor, len=%d)", len);
|
||||
}
|
||||
len -= pes.size + 4;
|
||||
|
||||
u8 fid_minor;
|
||||
if (!stream.get(fid_minor))
|
||||
{
|
||||
DMUX_ERROR("End of stream (PRIVATE_STREAM1, fid_minor)");
|
||||
throw EXCEPTION("End of stream (PRIVATE_STREAM1, fid_minor)");
|
||||
}
|
||||
|
||||
const u32 ch = fid_minor % 16;
|
||||
|
@ -460,7 +458,7 @@ void dmuxOpen(u32 dmux_id) // TODO: call from the constructor
|
|||
|
||||
if (len < 3 || !stream.check(3))
|
||||
{
|
||||
DMUX_ERROR("End of block (ATX, unknown header, len=%d)", len);
|
||||
throw EXCEPTION("End of block (ATX, unknown header, len=%d)", len);
|
||||
}
|
||||
len -= 3;
|
||||
stream.skip(3);
|
||||
|
@ -482,7 +480,7 @@ void dmuxOpen(u32 dmux_id) // TODO: call from the constructor
|
|||
|
||||
if (data[0] != 0x0f || data[1] != 0xd0)
|
||||
{
|
||||
DMUX_ERROR("ATX: 0x0fd0 header not found (ats=0x%llx)", *(be_t<u64>*)data);
|
||||
throw EXCEPTION("ATX: 0x0fd0 header not found (ats=0x%llx)", *(be_t<u64>*)data);
|
||||
}
|
||||
|
||||
u32 frame_size = ((((u32)data[2] & 0x3) << 8) | (u32)data[3]) * 8 + 8;
|
||||
|
@ -519,25 +517,25 @@ void dmuxOpen(u32 dmux_id) // TODO: call from the constructor
|
|||
|
||||
if (!stream.check(6))
|
||||
{
|
||||
DMUX_ERROR("End of stream (video, code=0x%x)", code);
|
||||
throw EXCEPTION("End of stream (video, code=0x%x)", code);
|
||||
}
|
||||
stream.skip(4);
|
||||
stream.get(len);
|
||||
|
||||
if (!stream.check(len))
|
||||
{
|
||||
DMUX_ERROR("End of stream (video, code=0x%x, len=%d)", code, len);
|
||||
throw EXCEPTION("End of stream (video, code=0x%x, len=%d)", code, len);
|
||||
}
|
||||
|
||||
const PesHeader pes(stream);
|
||||
if (!pes.is_ok)
|
||||
{
|
||||
DMUX_ERROR("PesHeader error (video, code=0x%x, len=%d)", code, len);
|
||||
throw EXCEPTION("PesHeader error (video, code=0x%x, len=%d)", code, len);
|
||||
}
|
||||
|
||||
if (len < pes.size + 3)
|
||||
{
|
||||
DMUX_ERROR("End of block (video, code=0x%x, PesHeader)", code);
|
||||
throw EXCEPTION("End of block (video, code=0x%x, PesHeader)", code);
|
||||
}
|
||||
len -= pes.size + 3;
|
||||
|
||||
|
@ -590,7 +588,7 @@ void dmuxOpen(u32 dmux_id) // TODO: call from the constructor
|
|||
{
|
||||
if ((code & PACKET_START_CODE_MASK) == PACKET_START_CODE_PREFIX)
|
||||
{
|
||||
DMUX_ERROR("Unknown code found (0x%x)", code);
|
||||
throw EXCEPTION("Unknown code found (0x%x)", code);
|
||||
}
|
||||
|
||||
// search
|
||||
|
@ -680,7 +678,7 @@ void dmuxOpen(u32 dmux_id) // TODO: call from the constructor
|
|||
//}
|
||||
else
|
||||
{
|
||||
DMUX_ERROR("dmuxEnableEs: unknown filter (0x%x, 0x%x, 0x%x, 0x%x)", es.fidMajor, es.fidMinor, es.sup1, es.sup2);
|
||||
throw EXCEPTION("dmuxEnableEs: unknown filter (0x%x, 0x%x, 0x%x, 0x%x)", es.fidMajor, es.fidMinor, es.sup1, es.sup2);
|
||||
}
|
||||
es.dmux = &dmux;
|
||||
break;
|
||||
|
@ -691,7 +689,7 @@ void dmuxOpen(u32 dmux_id) // TODO: call from the constructor
|
|||
ElementaryStream& es = *task.es.es_ptr;
|
||||
if (es.dmux != &dmux)
|
||||
{
|
||||
DMUX_ERROR("dmuxDisableEs: invalid elementary stream");
|
||||
throw EXCEPTION("dmuxDisableEs: invalid elementary stream");
|
||||
}
|
||||
|
||||
for (u32 i = 0; i < sizeof(esALL) / sizeof(esALL[0]); i++)
|
||||
|
@ -756,7 +754,7 @@ void dmuxOpen(u32 dmux_id) // TODO: call from the constructor
|
|||
|
||||
default:
|
||||
{
|
||||
DMUX_ERROR("Demuxer thread error: unknown task (0x%x)", task.type);
|
||||
throw EXCEPTION("Demuxer thread error: unknown task (0x%x)", task.type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,8 +19,6 @@ extern "C"
|
|||
|
||||
extern Module cellVdec;
|
||||
|
||||
#define VDEC_ERROR(...) { cellVdec.Error(__VA_ARGS__); Emu.Pause(); return; } // only for decoder thread
|
||||
|
||||
VideoDecoder::VideoDecoder(s32 type, u32 profile, u32 addr, u32 size, vm::ptr<CellVdecCbMsg> func, u32 arg)
|
||||
: type(type)
|
||||
, profile(profile)
|
||||
|
@ -63,28 +61,28 @@ VideoDecoder::VideoDecoder(s32 type, u32 profile, u32 addr, u32 size, vm::ptr<Ce
|
|||
}
|
||||
default:
|
||||
{
|
||||
VDEC_ERROR("VideoDecoder(): unknown type (0x%x)", type);
|
||||
throw EXCEPTION("Unknown type (0x%x)", type);
|
||||
}
|
||||
}
|
||||
|
||||
if (!codec)
|
||||
{
|
||||
VDEC_ERROR("VideoDecoder(): avcodec_find_decoder() failed");
|
||||
throw EXCEPTION("avcodec_find_decoder() failed");
|
||||
}
|
||||
if (!input_format)
|
||||
{
|
||||
VDEC_ERROR("VideoDecoder(): av_find_input_format() failed");
|
||||
throw EXCEPTION("av_find_input_format() failed");
|
||||
}
|
||||
fmt = avformat_alloc_context();
|
||||
if (!fmt)
|
||||
{
|
||||
VDEC_ERROR("VideoDecoder(): avformat_alloc_context() failed");
|
||||
throw EXCEPTION("avformat_alloc_context() failed");
|
||||
}
|
||||
io_buf = (u8*)av_malloc(4096);
|
||||
fmt->pb = avio_alloc_context(io_buf, 4096, 0, this, vdecRead, NULL, NULL);
|
||||
if (!fmt->pb)
|
||||
{
|
||||
VDEC_ERROR("VideoDecoder(): avio_alloc_context() failed");
|
||||
throw EXCEPTION("avio_alloc_context() failed");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -311,21 +309,21 @@ void vdecOpen(u32 vdec_id) // TODO: call from the constructor
|
|||
err = avformat_open_input(&vdec.fmt, NULL, NULL, &opts);
|
||||
if (err || opts)
|
||||
{
|
||||
VDEC_ERROR("vdecDecodeAu: avformat_open_input() failed (err=0x%x, opts=%d)", err, opts ? 1 : 0);
|
||||
throw EXCEPTION("avformat_open_input() failed (err=0x%x, opts=%d)", err, opts ? 1 : 0);
|
||||
}
|
||||
if (vdec.type == CELL_VDEC_CODEC_TYPE_DIVX)
|
||||
{
|
||||
err = avformat_find_stream_info(vdec.fmt, NULL);
|
||||
if (err || !vdec.fmt->nb_streams)
|
||||
{
|
||||
VDEC_ERROR("vdecDecodeAu: avformat_find_stream_info() failed (err=0x%x, nb_streams=%d)", err, vdec.fmt->nb_streams);
|
||||
throw EXCEPTION("avformat_find_stream_info() failed (err=0x%x, nb_streams=%d)", err, vdec.fmt->nb_streams);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!avformat_new_stream(vdec.fmt, vdec.codec))
|
||||
{
|
||||
VDEC_ERROR("vdecDecodeAu: avformat_new_stream() failed");
|
||||
throw EXCEPTION("avformat_new_stream() failed");
|
||||
}
|
||||
}
|
||||
vdec.ctx = vdec.fmt->streams[0]->codec; // TODO: check data
|
||||
|
@ -339,7 +337,7 @@ void vdecOpen(u32 vdec_id) // TODO: call from the constructor
|
|||
}
|
||||
if (err || opts)
|
||||
{
|
||||
VDEC_ERROR("vdecDecodeAu: avcodec_open2() failed (err=0x%x, opts=%d)", err, opts ? 1 : 0);
|
||||
throw EXCEPTION("avcodec_open2() failed (err=0x%x, opts=%d)", err, opts ? 1 : 0);
|
||||
}
|
||||
|
||||
vdec.just_started = false;
|
||||
|
@ -384,7 +382,7 @@ void vdecOpen(u32 vdec_id) // TODO: call from the constructor
|
|||
|
||||
if (!frame.data)
|
||||
{
|
||||
VDEC_ERROR("vdecDecodeAu: av_frame_alloc() failed");
|
||||
throw EXCEPTION("av_frame_alloc() failed");
|
||||
}
|
||||
|
||||
int got_picture = 0;
|
||||
|
@ -404,12 +402,12 @@ void vdecOpen(u32 vdec_id) // TODO: call from the constructor
|
|||
{
|
||||
if (frame.data->interlaced_frame)
|
||||
{
|
||||
VDEC_ERROR("vdecDecodeAu: interlaced frames not supported (0x%x)", frame.data->interlaced_frame);
|
||||
throw EXCEPTION("Interlaced frames not supported (0x%x)", frame.data->interlaced_frame);
|
||||
}
|
||||
|
||||
if (frame.data->repeat_pict)
|
||||
{
|
||||
VDEC_ERROR("vdecDecodeAu: repeated frames not supported (0x%x)", frame.data->repeat_pict);
|
||||
throw EXCEPTION("Repeated frames not supported (0x%x)", frame.data->repeat_pict);
|
||||
}
|
||||
|
||||
if (vdec.frc_set)
|
||||
|
@ -438,7 +436,7 @@ void vdecOpen(u32 vdec_id) // TODO: call from the constructor
|
|||
case CELL_VDEC_FRC_60: vdec.last_pts += 90000 / 60; break;
|
||||
default:
|
||||
{
|
||||
VDEC_ERROR("vdecDecodeAu: invalid frame rate code set (0x%x)", vdec.frc_set);
|
||||
throw EXCEPTION("Invalid frame rate code set (0x%x)", vdec.frc_set);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -471,7 +469,7 @@ void vdecOpen(u32 vdec_id) // TODO: call from the constructor
|
|||
case 60: case 0x100000000ull + 120: frame.frc = CELL_VDEC_FRC_60; break;
|
||||
default:
|
||||
{
|
||||
VDEC_ERROR("vdecDecodeAu: unsupported time_base.den (%d/1, tpf=%d)", vdec.ctx->time_base.den, vdec.ctx->ticks_per_frame);
|
||||
throw EXCEPTION("Unsupported time_base.den (%d/1, tpf=%d)", vdec.ctx->time_base.den, vdec.ctx->ticks_per_frame);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -491,12 +489,12 @@ void vdecOpen(u32 vdec_id) // TODO: call from the constructor
|
|||
}
|
||||
else
|
||||
{
|
||||
VDEC_ERROR("vdecDecodeAu: unsupported time_base.den (%d/1001, tpf=%d)", vdec.ctx->time_base.den, vdec.ctx->ticks_per_frame);
|
||||
throw EXCEPTION("Unsupported time_base.den (%d/1001, tpf=%d)", vdec.ctx->time_base.den, vdec.ctx->ticks_per_frame);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
VDEC_ERROR("vdecDecodeAu: unsupported time_base.num (%d)", vdec.ctx->time_base.num);
|
||||
throw EXCEPTION("Unsupported time_base.num (%d)", vdec.ctx->time_base.num);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -532,7 +530,7 @@ void vdecOpen(u32 vdec_id) // TODO: call from the constructor
|
|||
|
||||
default:
|
||||
{
|
||||
VDEC_ERROR("VideoDecoder thread error: unknown task(%d)", task.type);
|
||||
throw EXCEPTION("Unknown task(%d)", task.type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue