cleanup, remove separate audio and video queues

This commit is contained in:
Isaac Connor 2016-08-31 15:38:44 -04:00
parent 4dce24a276
commit a51944b2c5
2 changed files with 13 additions and 49 deletions

View File

@ -24,24 +24,15 @@
using namespace std; using namespace std;
zm_packetqueue::zm_packetqueue() zm_packetqueue::zm_packetqueue(){
: MaxVideoQueueSize(VIDEO_QUEUESIZE)
, MaxAudioQueueSize(AUDIO_QUEUESIZE) {
} }
zm_packetqueue::~zm_packetqueue() { zm_packetqueue::~zm_packetqueue() {
} }
bool zm_packetqueue::queueVideoPacket(AVPacket* packet) { bool zm_packetqueue::queuePacket( AVPacket* packet ) {
return queuePacket(VideoQueue, packet);
}
bool zm_packetqueue::queueAudioPacket(AVPacket* packet)
{
return queuePacket(AudioQueue, packet);
}
bool zm_packetqueue::queuePacket(queue<AVPacket>& pktQueue, AVPacket* packet){
AVPacket input_ref = { 0 }; AVPacket input_ref = { 0 };
if ( av_packet_ref(&input_ref, packet) < 0 ) { if ( av_packet_ref(&input_ref, packet) < 0 ) {
@ -52,10 +43,8 @@ bool zm_packetqueue::queuePacket(queue<AVPacket>& pktQueue, AVPacket* packet){
return true; return true;
} }
bool zm_packetqueue::popPacket(queue<AVPacket>& pktQueue, AVPacket* packet) bool zm_packetqueue::popPacket( AVPacket* packet ) {
{ if ( pktQueue.empty() ) {
if (pktQueue.empty())
{
return false; return false;
} }
@ -65,27 +54,8 @@ bool zm_packetqueue::popPacket(queue<AVPacket>& pktQueue, AVPacket* packet)
return true; return true;
} }
void zm_packetqueue::clearQueue(std::queue<AVPacket>& pktQueue) void zm_packetqueue::clearQueue() {
{ while(!pktQueue.empty()) {
while(!pktQueue.empty())
{
pktQueue.pop(); pktQueue.pop();
} }
} }
void zm_packetqueue::clearQueues()
{
clearQueue(VideoQueue);
clearQueue(AudioQueue);
}
bool zm_packetqueue::popAudioPacket(AVPacket* packet)
{
return popPacket(AudioQueue, packet);
}
bool zm_packetqueue::popVideoPacket(AVPacket* packet)
{
return popPacket(VideoQueue, packet);
}

View File

@ -33,19 +33,13 @@ class zm_packetqueue {
public: public:
zm_packetqueue(); zm_packetqueue();
virtual ~zm_packetqueue(); virtual ~zm_packetqueue();
bool queuePacket(std::queue<AVPacket>& pktQueue, AVPacket* packet); bool queuePacket( AVPacket* packet );
bool queueVideoPacket(AVPacket* packet); bool popPacket( AVPacket* packet );
bool queueAudioPacket(AVPacket* packet);
bool popPacket(std::queue<AVPacket>& pktQueue, AVPacket* packet);
bool popVideoPacket(AVPacket* packet); bool popVideoPacket(AVPacket* packet);
bool popAudioPacket(AVPacket* packet); bool popAudioPacket(AVPacket* packet);
void clearQueues(); void clearQueue( );
void clearQueue(std::queue<AVPacket>& pktQueue);
private: private:
int MaxVideoQueueSize; std::queue<AVPacket> pktQueue;
int MaxAudioQueueSize;
std::queue<AVPacket> VideoQueue;
std::queue<AVPacket> AudioQueue;
}; };