From b566353568b255fb8cfb5f0f90feb7cf55183edf Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Thu, 7 Jun 2018 14:56:46 +0100 Subject: [PATCH] Some compiler warning fixes --- audioomx.cc | 98 ++++++++++++++++++++++++++--------------------------- bitmap.cc | 9 +++-- command.cc | 2 +- 3 files changed, 56 insertions(+), 53 deletions(-) diff --git a/audioomx.cc b/audioomx.cc index e7980e2..a68296a 100644 --- a/audioomx.cc +++ b/audioomx.cc @@ -1786,7 +1786,7 @@ bool AudioOMX::DrainTargetBufferFull() } -UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, +UINT AudioOMX::DeliverMediaPacket(MediaPacket mpacket, const UCHAR* buffer, UINT *samplepos) { /*First Check, if we have an audio sample*/ VideoOMX *vw = (VideoOMX*) Video::getInstance(); @@ -1803,21 +1803,21 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, if (vw->isClockPaused()) return 0; //Block if we pause //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 1"); - //Log::getInstance()->log("Audio", Log::DEBUG, "DeliverMediaPacketOMX time %lld",packet.presentation_time); + //Log::getInstance()->log("Audio", Log::DEBUG, "DeliverMediaPacketOMX time %lld",mpacket.presentation_time); -/* if (packet.synched && packet.presentation_time <= 0) { - *samplepos = packet.length; +/* if (mpacket.synched && mpacket.presentation_time <= 0) { + *samplepos = mpacket.length; firstsynched = false; lsync=true; Log::getInstance()->log("Audio", Log::DEBUG, "DeliverMediaPacketOMX Frameskip"); - return packet.length; + return mpacket.length; }*/ //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 2"); UINT headerstrip = 0; - if (packet.disconti) { + if (mpacket.disconti) { firstsynched = false; decompress_buffer_filled=0; if (cur_input_buf_omx) { @@ -1832,12 +1832,12 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, lsync=true; } //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 3"); - if (packet.type != lastAType) {//Format Change //Push data out ! + if (mpacket.type != lastAType) {//Format Change //Push data out ! firstsynched = false; achange=true; mp3sameheader=0; - Log::getInstance()->log("Audio", Log::DEBUG,"Notice audio type change %d %d", packet.type,lastAType); - lastAType = packet.type; + Log::getInstance()->log("Audio", Log::DEBUG,"Notice audio type change %d %d", mpacket.type,lastAType); + lastAType = mpacket.type; decompress_buffer_filled=0; if (cur_input_buf_omx) { @@ -1868,12 +1868,12 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 4"); /*Inspect PES-Header */ - if (*samplepos == 0 && packet.type != MPTYPE_MPEG_AUDIO_LAYER3) {//stripheader - headerstrip = buffer[packet.pos_buffer + 8] + 9; - if (packet.type == MPTYPE_AC3) + if (*samplepos == 0 && mpacket.type != MPTYPE_MPEG_AUDIO_LAYER3) {//stripheader + headerstrip = buffer[mpacket.pos_buffer + 8] + 9; + if (mpacket.type == MPTYPE_AC3) headerstrip += 4; //skip ac3 bytes *samplepos += headerstrip; - if (packet.synched) { + if (mpacket.synched) { if (cur_input_buf_omx) { //cur_input_buf_omx->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME; error = vw->ProtOMXEmptyThisBuffer(omx_aud_rend/*dec*/, @@ -1890,10 +1890,10 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, //decompress_buffer_filled=0; } else { if (!firstsynched) {// - *samplepos = packet.length;//if we have not processed at least one + *samplepos = mpacket.length;//if we have not processed at least one decompress_buffer_filled=0; //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 5"); - return packet.length;//synched packet ignore it! + return mpacket.length;//synched packet ignore it! } } } @@ -1916,11 +1916,11 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 7"); if (cur_input_buf_omx->nFilledLen == 0) {//will only be changed on first packet - if (packet.synched) { + if (mpacket.synched) { //Log::getInstance()->log("Audio", Log::DEBUG, // "packet synched marker"); - //lastreftimePTS=packet.pts; + //lastreftimePTS=mpacket.pts; if (omx_first_frame) { // TODO time cur_input_buf_omx->nFlags = OMX_BUFFERFLAG_STARTTIME; Log::getInstance()->log("Audio", Log::DEBUG, "Starttime"); @@ -1929,10 +1929,10 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, cur_input_buf_omx->nFlags = 0; //cur_input_buf_omx->nFlags|=OMX_BUFFERFLAG_TIME_UNKNOWN; } - lastreftimeOMX = packet.presentation_time; + lastreftimeOMX = mpacket.presentation_time; //Log::getInstance()->log("Audio", Log::DEBUG, - // "Time code %lld pts %lld dts %lld", lastreftimeOMX, packet.pts,packet.dts); - lastreftimePTS = packet.pts; + // "Time code %lld pts %lld dts %lld", lastreftimeOMX, mpacket.pts,mpacket.dts); + lastreftimePTS = mpacket.pts; cur_input_buf_omx->nTimeStamp = VideoOMX::intToOMXTicks(lastreftimeOMX/10LL); // the clock component is faulty; } else { // Log::getInstance()->log("Audio", Log::DEBUG, @@ -1941,7 +1941,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, cur_input_buf_omx->nTimeStamp = VideoOMX::intToOMXTicks(0); } - if (packet.disconti || achange) { + if (mpacket.disconti || achange) { cur_input_buf_omx->nFlags |= OMX_BUFFERFLAG_DISCONTINUITY; //mp23codec_context_libav->frame_size=-1; //ac3codec_context_libav->frame_size=-1; @@ -1950,8 +1950,8 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, } //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 8"); - if (*samplepos>packet.length) *samplepos=0; //propably the thread got interrupted and sample is not valid any more! - unsigned int haveToCopy=packet.length-*samplepos; + if (*samplepos>mpacket.length) *samplepos=0; //propably the thread got interrupted and sample is not valid any more! + unsigned int haveToCopy=mpacket.length-*samplepos; if (passthrough) { while (haveToCopy>0) { @@ -1959,22 +1959,22 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, if (lsync) { unsigned int gotframesize=0; int adv=0; - switch (packet.type) { + switch (mpacket.type) { case MPTYPE_MPEG_AUDIO: case MPTYPE_MPEG_AUDIO_LAYER3: { - adv = AdvanceMpAudioSync(buffer+packet.pos_buffer+*samplepos, + adv = AdvanceMpAudioSync(buffer+mpacket.pos_buffer+*samplepos, haveToCopy,&gotframesize); } break; case MPTYPE_AC3: case MPTYPE_AC3_PRE13: { - adv = AdvanceAc3AudioSync(buffer+packet.pos_buffer+*samplepos, + adv = AdvanceAc3AudioSync(buffer+mpacket.pos_buffer+*samplepos, haveToCopy,&gotframesize); } break; case MPTYPE_AAC_LATM: { - adv = AdvanceAacLatmAudioSync(buffer+packet.pos_buffer+*samplepos, + adv = AdvanceAacLatmAudioSync(buffer+mpacket.pos_buffer+*samplepos, haveToCopy,&gotframesize); } break; @@ -1984,14 +1984,14 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, haveToCopy-=adv; *samplepos+=adv; } else { - *samplepos=packet.length; //no ac3 sync byte + *samplepos=mpacket.length; //no ac3 sync byte //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 10"); - return packet.length; + return mpacket.length; } } // so everything is fine now do a memcpy int cancopy=min(haveToCopy,cur_input_buf_omx->nAllocLen-cur_input_buf_omx->nFilledLen); - memcpy(cur_input_buf_omx->pBuffer+cur_input_buf_omx->nFilledLen,buffer+packet.pos_buffer+*samplepos,cancopy); + memcpy(cur_input_buf_omx->pBuffer+cur_input_buf_omx->nFilledLen,buffer+mpacket.pos_buffer+*samplepos,cancopy); haveToCopy-=cancopy; cur_input_buf_omx->nFilledLen+=cancopy; *samplepos+=cancopy; @@ -2031,7 +2031,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, int errcount=0; AVCodecContext *current_context; - switch (packet.type) { + switch (mpacket.type) { case MPTYPE_MPEG_AUDIO: case MPTYPE_MPEG_AUDIO_LAYER3: { current_context = mp23codec_context_libav; @@ -2050,13 +2050,13 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, if (decompress_buffer_filled) { // have a remaining paket incoming_paket_libav.data =(uint8_t*) decompress_buffer; memcpy(decompress_buffer+decompress_buffer_filled, - buffer+packet.pos_buffer+*samplepos, + buffer+mpacket.pos_buffer+*samplepos, min(haveToCopy,decompress_buffer_size-decompress_buffer_filled)); incoming_paket_libav.size = decompress_buffer_filled +min(haveToCopy,decompress_buffer_size-decompress_buffer_filled); - //Log::getInstance()->log("Audio", Log::DEBUG,"Use saved audio buffer %d %d %d",packet.type,decompress_buffer_filled,packet.synched); + //Log::getInstance()->log("Audio", Log::DEBUG,"Use saved audio buffer %d %d %d",mpacket.type,decompress_buffer_filled,mpacket.synched); } else { - incoming_paket_libav.data =(uint8_t*) buffer+packet.pos_buffer+*samplepos; + incoming_paket_libav.data =(uint8_t*) buffer+mpacket.pos_buffer+*samplepos; incoming_paket_libav.size = haveToCopy; } //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 18"); @@ -2071,7 +2071,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, unsigned int gotframesize=0; // if (!decompress_buffer_filled) { // only do this if no old data is present int adv = 0; - switch (packet.type) { + switch (mpacket.type) { case MPTYPE_MPEG_AUDIO: case MPTYPE_MPEG_AUDIO_LAYER3: { adv = AdvanceMpAudioSync(incoming_paket_libav.data, @@ -2097,11 +2097,11 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, *samplepos += adv; /*if (current_context->frame_size>0) framesize=min(current_context->frame_size,haveToCopy); else*/ framesize=haveToCopy; - //Log::getInstance()->log("Audio", Log::DEBUG,"Advance by %d %d from %d",adv,packet.type,*samplepos ); + //Log::getInstance()->log("Audio", Log::DEBUG,"Advance by %d %d from %d",adv,mpacket.type,*samplepos ); if (haveToCopy <= 0) { - // Log::getInstance()->log("Audio", Log::DEBUG,"No sync code in packet remove %d",packet.type); - *samplepos=packet.length; - return packet.length; + // Log::getInstance()->log("Audio", Log::DEBUG,"No sync code in packet remove %d",mpacket.type); + *samplepos=mpacket.length; + return mpacket.length; } @@ -2167,7 +2167,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, } else { framesize=haveToCopy; } - incoming_paket_libav.data =(uint8_t*) buffer+packet.pos_buffer+*samplepos; + incoming_paket_libav.data =(uint8_t*) buffer+mpacket.pos_buffer+*samplepos; errcount=0; decompress_buffer_filled=0; } else { @@ -2194,15 +2194,15 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, int dsize = av_samples_get_buffer_size(NULL, /*current_context->channels*/2, decode_frame_libav->nb_samples, AV_SAMPLE_FMT_S16, 1); - int dsize_in = av_samples_get_buffer_size(NULL, + /* int dsize_in = av_samples_get_buffer_size(NULL, current_context->channels, decode_frame_libav->nb_samples, - current_context->sample_fmt, 1); + current_context->sample_fmt, 1); -- unused */ //if (current_context->channels==1) dsize*=2; // we convert mono to stereo if ((cur_input_buf_omx->nFilledLen + dsize) > cur_input_buf_omx->nAllocLen ) { // I doubt that this will ever happen // Log::getInstance()->log("Audio", Log::DEBUG, - // "P 2 Time code %lld pts %lld", lastreftimeOMX, packet.pts); + // "P 2 Time code %lld pts %lld", lastreftimeOMX, mpacket.pts); error = vw->ProtOMXEmptyThisBuffer(omx_aud_rend/*dec*/, cur_input_buf_omx); if (error != OMX_ErrorNone) { @@ -2264,7 +2264,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, //Log::getInstance()->log("Audio", Log::DEBUG,"memcpy out"); cur_input_buf_omx->nFilledLen += dsize; } else { - //Log::getInstance()->log("Audio", Log::DEBUG,"Incomplete mpeg frames in pes packet %d %d",incoming_paket_libav.size,packet.length); + //Log::getInstance()->log("Audio", Log::DEBUG,"Incomplete mpeg frames in pes packet %d %d",incoming_paket_libav.size,mpacket.length); /* uint8_t a1=incoming_paket_libav.data[0]; uint8_t a2=incoming_paket_libav.data[1]; uint8_t a3=incoming_paket_libav.data[2]; @@ -2277,7 +2277,7 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 24"); decompress_buffer_filled=0; if (haveToCopy ) { - //Log::getInstance()->log("Audio", Log::DEBUG,"We can not decompress %d save for later %d %x %x",haveToCopy,packet.type,incoming_paket_libav.data,packet.pos_buffer); + //Log::getInstance()->log("Audio", Log::DEBUG,"We can not decompress %d save for later %d %x %x",haveToCopy,mpacket.type,incoming_paket_libav.data,mpacket.pos_buffer); memcpy(decompress_buffer,incoming_paket_libav.data,min(haveToCopy,decompress_buffer_size)); decompress_buffer_filled=min(haveToCopy,decompress_buffer_size); @@ -2286,13 +2286,13 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, if (cur_input_buf_omx->nFilledLen) { //Log::getInstance()->log("Audio", Log::DEBUG, - // "P 3 Time code %lld pts %lld", lastreftimeOMX, packet.pts); + // "P 3 Time code %lld pts %lld", lastreftimeOMX, mpacket.pts); error = vw->ProtOMXEmptyThisBuffer(omx_aud_rend/*dec*/, cur_input_buf_omx); if (error != OMX_ErrorNone) { Log::getInstance()->log("Audio", Log::DEBUG, "OMX_EmptyThisBuffer 5 failed %x", error); } - //if (packet.synched) vw->AdjustAudioPTS(correctAudioLatency(lastreftimeOMX,cur_input_buf_omx->nFilledLen/(2*2),48000)); + //if (mpacket.synched) vw->AdjustAudioPTS(correctAudioLatency(lastreftimeOMX,cur_input_buf_omx->nFilledLen/(2*2),48000)); cur_input_buf_omx = NULL; } } @@ -2300,8 +2300,8 @@ UINT AudioOMX::DeliverMediaPacket(MediaPacket packet, const UCHAR* buffer, //Log::getInstance()->log("Audio", Log::DEBUG, "DMP mark 25"); - *samplepos=packet.length; - return packet.length; + *samplepos=mpacket.length; + return mpacket.length; } diff --git a/bitmap.cc b/bitmap.cc index 7dde884..cd60cdd 100644 --- a/bitmap.cc +++ b/bitmap.cc @@ -53,9 +53,12 @@ ULONG Palette::yrba2argb(UCHAR y, UCHAR cr, UCHAR cb, UCHAR a) r = (4769*(y-16) + 6537*(cr-128) + 2048) / 4096; g = (4769*(y-16) - 3329*(cr-128) - 1604*(cb-128) + 2048) / 4096; b = (4769*(y-16) + 8263*(cb-128) + 2048) / 4096; - if (r < 0) r = 0; if (r > 255) r = 255; - if (g < 0) g = 0; if (g > 255) g = 255; - if (b < 0) b = 0; if (b > 255) b = 255; + if (r < 0) r = 0; + if (r > 255) r = 255; + if (g < 0) g = 0; + if (g > 255) g = 255; + if (b < 0) b = 0; + if (b > 255) b = 255; return (a << 24) + (r << 16) + (g << 8) + b; } diff --git a/command.cc b/command.cc index 5cc948e..40f9815 100644 --- a/command.cc +++ b/command.cc @@ -815,7 +815,7 @@ int Command::getLangPref(bool subtitle,const char* langcode) while (itty != langcodes.end()) { size_t pos=(*itty).langcode.find(templangcode); if (pos != string::npos) { - vector::iterator itty2=langcodes.begin(); + //vector::iterator itty2=langcodes.begin(); for (unsigned int i=0; i