uint8_t remainder[-_delay_in_bytes];
_delay_line->get_remaining (remainder);
_audio_frames_processed += _delay_in_bytes / (_fs->audio_channels() * bytes_per_audio_sample());
- emit_audio (remainder, _delay_in_bytes);
+ emit_audio (remainder, -_delay_in_bytes);
}
/* If we cut the decode off, the audio may be short; push some silence
_decoder->go ();
fs->set_length (_decoder->last_video_frame ());
- fs->set_audio_delay (-_decoder->audio_to_discard ());
_log->log (String::compose ("Video length is %1 frames", _decoder->last_video_frame()));
_log->log (String::compose ("%1ms of audio to discard", _decoder->audio_to_discard()));
{
return _decoder->last_video_frame ();
}
+
+int
+ExamineContentJob::audio_to_discard () const
+{
+ return _decoder->audio_to_discard ();
+}
+
void run ();
int last_video_frame () const;
+ int audio_to_discard () const;
private:
boost::shared_ptr<Decoder> _decoder;
, _dirty (false)
{}
+ FilmState (FilmState const & o)
+ : _directory (o._directory)
+ , _name (o._name)
+ , _use_dci_name (o._use_dci_name)
+ , _content (o._content)
+ , _dcp_content_type (o._dcp_content_type)
+ , _format (o._format)
+ , _crop (o._crop)
+ , _filters (o._filters)
+ , _scaler (o._scaler)
+ , _dcp_frames (o._dcp_frames)
+ , _dcp_trim_action (o._dcp_trim_action)
+ , _dcp_ab (o._dcp_ab)
+ , _audio_stream (o._audio_stream)
+ , _audio_gain (o._audio_gain)
+ , _audio_delay (o._audio_delay)
+ , _still_duration (o._still_duration)
+ , _subtitle_stream (o._subtitle_stream)
+ , _with_subtitles (o._with_subtitles)
+ , _subtitle_offset (o._subtitle_offset)
+ , _subtitle_scale (o._subtitle_scale)
+ , _audio_language (o._audio_language)
+ , _subtitle_language (o._subtitle_language)
+ , _territory (o._territory)
+ , _rating (o._rating)
+ , _studio (o._studio)
+ , _facility (o._facility)
+ , _package_type (o._package_type)
+ , _thumbs (o._thumbs)
+ , _size (o._size)
+ , _length (o._length)
+ , _audio_sample_rate (o._audio_sample_rate)
+ , _content_digest (o._content_digest)
+ , _has_subtitles (o._has_subtitles)
+ , _audio_streams (o._audio_streams)
+ , _subtitle_streams (o._subtitle_streams)
+ , _frames_per_second (o._frames_per_second)
+ , _dirty (o._dirty)
+ {}
+
virtual ~FilmState () {}
std::string file (std::string f) const;
#include <boost/bind.hpp>
#include <boost/lambda/lambda.hpp>
#include <boost/lexical_cast.hpp>
+#include <boost/thread.hpp>
#include <openjpeg.h>
#include <openssl/md5.h>
#include <magick/MagickCore.h>
using namespace std;
using namespace boost;
+thread::id ui_thread;
+
/** Convert some number of seconds to a string representation
* in hours, minutes and seconds.
*
}
#endif
-/** Call the required functions to set up DVD-o-matic's static arrays, etc. */
+/** Call the required functions to set up DVD-o-matic's static arrays, etc.
+ * Must be called from the UI thread, if there is one.
+ */
void
dvdomatic_setup ()
{
Filter::setup_filters ();
SoundProcessor::setup_sound_processors ();
+ ui_thread = this_thread::get_id ();
+
#ifdef DVDOMATIC_POSIX
struct sigaction sa;
sa.sa_flags = SA_SIGINFO;
_frames = f;
}
-
-
+void
+ensure_ui_thread ()
+{
+ assert (this_thread::get_id() == ui_thread);
+}
extern std::vector<std::string> split_at_spaces_considering_quotes (std::string);
extern std::string md5_digest (std::string);
extern std::string md5_digest (void const *, int);
+extern void ensure_ui_thread ();
enum ContentType {
STILL,
void
FilmEditor::film_changed (FilmState::Property p)
{
+ ensure_ui_thread ();
+
if (!_film || _ignore_changes == p) {
return;
}
void
FilmViewer::film_changed (FilmState::Property p)
{
+ ensure_ui_thread ();
+
switch (p) {
case FilmState::THUMBS:
if (_film && _film->thumbs().size() > 1) {