X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=pv%2Fdata%2Fdecoderstack.h;h=1badc6b9b34988aafb41265b54d9b5681be64852;hb=f9abf97e78bc4825d80926b0ebc6cbaef40768b1;hp=58dd887145c62cc6bb98dfa18d43c316112b649b;hpb=db62bbfda512aeddca5b9d7b5960e9cf24b8859c;p=pulseview.git diff --git a/pv/data/decoderstack.h b/pv/data/decoderstack.h index 58dd887..1badc6b 100644 --- a/pv/data/decoderstack.h +++ b/pv/data/decoderstack.h @@ -24,16 +24,22 @@ #include "signaldata.h" #include +#include -#include +#include #include #include #include +#include +#include + struct srd_decoder; -struct srd_probe; +struct srd_decoder_annotation_row; +struct srd_channel; struct srd_proto_data; +struct srd_session; namespace DecoderStackTest { class TwoDecoderStack; @@ -41,18 +47,18 @@ class TwoDecoderStack; namespace pv { +class SigSession; + namespace view { class LogicSignal; - -namespace decode { -class Annotation; -} - } namespace data { +class LogicSnapshot; + namespace decode { +class Annotation; class Decoder; } @@ -66,19 +72,29 @@ private: static const double DecodeMargin; static const double DecodeThreshold; static const int64_t DecodeChunkLength; + static const unsigned int DecodeNotifyPeriod; public: - DecoderStack(const srd_decoder *const decoder); + DecoderStack(pv::SigSession &_session, + const srd_decoder *const decoder); virtual ~DecoderStack(); - const std::list< boost::shared_ptr >& stack() const; - void push(boost::shared_ptr decoder); + const std::list< std::shared_ptr >& stack() const; + void push(std::shared_ptr decoder); void remove(int index); int64_t samples_decoded() const; - const std::vector annotations() const; + std::vector get_visible_rows() const; + + /** + * Extracts sorted annotations between two period into a vector. + */ + void get_annotation_subset( + std::vector &dest, + const decode::Row &row, uint64_t start_sample, + uint64_t end_sample) const; QString error_message(); @@ -89,15 +105,28 @@ public: void begin_decode(); private: - void decode_proc(boost::shared_ptr data); + boost::optional wait_for_data() const; + + void decode_data(const int64_t sample_count, + const unsigned int unit_size, srd_session *const session); + + void decode_proc(); static void annotation_callback(srd_proto_data *pdata, void *decoder); +private slots: + void on_new_frame(); + + void on_data_received(); + + void on_frame_ended(); + signals: void new_decode_data(); private: + pv::SigSession &_session; /** * This mutex prevents more than one decode operation occuring @@ -107,11 +136,22 @@ private: */ static boost::mutex _global_decode_mutex; - std::list< boost::shared_ptr > _stack; + std::list< std::shared_ptr > _stack; - mutable boost::mutex _mutex; + std::shared_ptr _snapshot; + + mutable boost::mutex _input_mutex; + mutable boost::condition_variable _input_cond; + int64_t _sample_count; + bool _frame_complete; + + mutable boost::mutex _output_mutex; int64_t _samples_decoded; - std::vector _annotations; + + std::map _rows; + + std::map, decode::Row> _class_rows; + QString _error_message; boost::thread _decode_thread;