Merge master.
authorCarl Hetherington <cth@carlh.net>
Sun, 28 Apr 2013 17:16:05 +0000 (18:16 +0100)
committerCarl Hetherington <cth@carlh.net>
Sun, 28 Apr 2013 17:16:05 +0000 (18:16 +0100)
1  2 
debian/changelog
src/lib/po/it_IT.po
src/lib/sndfile_decoder.cc
src/lib/sndfile_decoder.h
src/tools/po/it_IT.po
src/wx/po/it_IT.po

Simple merge
Simple merge
index 4db45f1d40f14b53552997665fbff8198ba59df9,fdaf2eeaaf4397ad5d1cb1430ebc6d006607a5b7..9ba972e565ffbdb47b52056f2aaede885dcee560
@@@ -31,26 -30,67 +31,24 @@@ using std::string
  using std::min;
  using std::cout;
  using boost::shared_ptr;
 -using boost::optional;
  
 -SndfileDecoder::SndfileDecoder (shared_ptr<Film> f, DecodeOptions o)
 -      : Decoder (f, o)
 -      , AudioDecoder (f, o)
 -      , _done (0)
 -      , _frames (0)
 +SndfileDecoder::SndfileDecoder (shared_ptr<const Film> f, shared_ptr<const SndfileContent> c)
 +      : Decoder (f)
 +      , AudioDecoder (f)
 +      , _sndfile_content (c)
  {
 -      _done = 0;
 -      _frames = 0;
 -      
 -      vector<string> const files = _film->external_audio ();
 -
 -      int N = 0;
 -      for (size_t i = 0; i < files.size(); ++i) {
 -              if (!files[i].empty()) {
 -                      N = i + 1;
 -              }
 -      }
 -
 -      if (N == 0) {
 -              return;
 +      _sndfile = sf_open (_sndfile_content->file().string().c_str(), SFM_READ, &_info);
 +      if (!_sndfile) {
 +              throw DecodeError (_("could not open audio file for reading"));
        }
  
 -      bool first = true;
 -      
 -      for (size_t i = 0; i < (size_t) N; ++i) {
 -              if (files[i].empty ()) {
 -                      _sndfiles.push_back (0);
 -              } else {
 -                      SF_INFO info;
 -                      SNDFILE* s = sf_open (files[i].c_str(), SFM_READ, &info);
 -                      if (!s) {
 -                              throw DecodeError (_("could not open external audio file for reading"));
 -                      }
 -
 -                      if (info.channels != 1) {
 -                              throw DecodeError (_("external audio files must be mono"));
 -                      }
 -                      
 -                      _sndfiles.push_back (s);
 +      _done = 0;
 +      _remaining = _info.frames;
 +}
  
 -                      if (first) {
 -                              shared_ptr<SndfileStream> st (
 -                                      new SndfileStream (
 -                                              info.samplerate, av_get_default_channel_layout (N)
 -                                              )
 -                                      );
 -                              
 -                              _audio_streams.push_back (st);
 -                              _audio_stream = st;
 -                              _frames = info.frames;
 -                              first = false;
 -                      } else {
 -                              if (info.frames != _frames) {
 -                                      throw DecodeError (_("external audio files have differing lengths"));
 -                              }
 -                      }
 -              }
 -      }
 +SndfileDecoder::~SndfileDecoder ()
 +{
-       if (_sndfile) {
-               sf_close (_sndfile);
-       }
++      sf_close (_sndfile);
  }
  
  bool
index b999a66d15f40644bb0313614c5d9c771e7b17cf,9489cb5ec5b56e4a6b076ff0da1360e643a19734..1d212cc9b26871bb972f96f135d91cac48736f8c
@@@ -31,17 -49,8 +31,14 @@@ public
  
        bool pass ();
  
 +      int audio_channels () const;
 +      ContentAudioFrame audio_length () const;
 +      int audio_frame_rate () const;
 +
  private:
-       SNDFILE* open_file (sf_count_t &);
-       void close_file (SNDFILE*);
 -      std::vector<SNDFILE*> _sndfiles;
 -      sf_count_t _done;
 -      sf_count_t _frames;
 +      boost::shared_ptr<const SndfileContent> _sndfile_content;
 +      SNDFILE* _sndfile;
 +      SF_INFO _info;
 +      ContentAudioFrame _done;
 +      ContentAudioFrame _remaining;
  };
Simple merge
Simple merge