Various attempts to clean up DCP comparison code.
[libdcp.git] / src / sound_mxf.h
index 4216accb5dc4063dfca03dd6f77b2168a453577f..d6978953f6ffaeb18e6fc6eea3ce39137498fe9f 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 
 */
 
-#ifndef LIBDCP_SOUND_ASSET_H
-#define LIBDCP_SOUND_ASSET_H
-
-/** @file  src/sound_asset.h
- *  @brief An asset made up of PCM audio data files
+/** @file  src/sound_mxf.h
+ *  @brief SoundMXF class
  */
 
+#ifndef LIBDCP_SOUND_MXF_H
+#define LIBDCP_SOUND_MXF_H
+
 #include "mxf.h"
 #include "types.h"
 #include "metadata.h"
@@ -32,73 +32,44 @@ namespace dcp
 {
 
 class SoundFrame;
-class SoundMXF;
-
-class SoundMXFWriter
-{
-public:
-       void write (float const * const *, int);
-       void finalize ();
+class SoundMXFWriter;
 
-private:
-       friend class SoundMXF;
-
-       SoundMXFWriter (SoundMXF *);
-
-       /* no copy construction */
-       SoundMXFWriter (SoundMXFWriter const &);
-       SoundMXFWriter& operator= (SoundMXFWriter const &);
-       
-       void write_current_frame ();
-
-       /* do this with an opaque pointer so we don't have to include
-          ASDCP headers
-       */
-          
-       struct ASDCPState;
-       boost::shared_ptr<ASDCPState> _state;
-
-       SoundMXF* _asset;
-       bool _finalized;
-       int _frames_written;
-       int _frame_buffer_offset;
-};
-
-/** @brief An asset made up of WAV files */
+/** @class SoundMXF
+ *  @brief Representation of a MXF file containing sound
+ */
 class SoundMXF : public MXF
 {
 public:
        SoundMXF (boost::filesystem::path file);
+       SoundMXF (Fraction edit_rate, int sampling_rate, int channels);
 
-       boost::shared_ptr<SoundMXFWriter> start_write ();
+       boost::shared_ptr<SoundMXFWriter> start_write (boost::filesystem::path file, Standard standard);
        
-       bool equals (boost::shared_ptr<const Content> other, EqualityOptions opt, boost::function<void (NoteType, std::string)> note) const;
+       bool equals (
+               boost::shared_ptr<const Asset> other,
+               EqualityOptions opt,
+               boost::function<void (NoteType, std::string)> note
+               ) const;
 
        boost::shared_ptr<const SoundFrame> get_frame (int n) const;
 
-       void set_channels (int c) {
-               _channels = c;
-       }
-       
+       /** @return number of channels */
        int channels () const {
                return _channels;
        }
 
-       void set_sampling_rate (int s) {
-               _sampling_rate = s;
-       }
-
+       /** @return sampling rate in Hz */
        int sampling_rate () const {
                return _sampling_rate;
        }
 
 private:
-       std::string key_type () const;
-       std::string cpl_node_name () const;
+       std::string asdcp_kind () const {
+               return "Sound";
+       }
 
-       /** Number of channels in the asset */
-       int _channels;
-       int _sampling_rate;
+       int _channels;      ///< number of channels
+       int _sampling_rate; ///< sampling rate in Hz
 };
 
 }