Internal change

PiperOrigin-RevId: 164326481
Change-Id: I02c5a803d4c5e131425093778ecdf3fcd1c4d3b5
diff --git a/src/atom_camm.cpp b/src/atom_camm.cpp
new file mode 100644
index 0000000..a7ebbd7
--- /dev/null
+++ b/src/atom_camm.cpp
@@ -0,0 +1,42 @@
+/*
+ * The contents of this file are subject to the Mozilla Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is MPEG4IP.
+ *
+ * The Initial Developer of the Original Code is Cisco Systems Inc.
+ * Portions created by Cisco Systems Inc. are
+ * Copyright (C) Cisco Systems Inc. 2001.  All Rights Reserved.
+ *
+ */
+
+#include "src/impl.h"
+
+namespace mp4v2 {
+namespace impl {
+
+///////////////////////////////////////////////////////////////////////////////
+
+MP4CammAtom::MP4CammAtom(MP4File &file)
+        : MP4Atom(file, "camm")
+{
+    AddVersionAndFlags();
+
+    MP4Integer32Property* pCount =
+        new MP4Integer32Property(*this, "entryCount");
+    pCount->SetValue(1);
+    pCount->SetReadOnly();
+    AddProperty(pCount);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+}
+} // namespace mp4v2::impl
diff --git a/src/atoms.h b/src/atoms.h
index 382706f..672eee7 100644
--- a/src/atoms.h
+++ b/src/atoms.h
@@ -288,6 +288,15 @@
  * Specialized Atoms
  ************************************************************************/
 
+class MP4CammAtom : public MP4Atom {
+public:
+    MP4CammAtom(MP4File &file);
+private:
+    MP4CammAtom();
+    MP4CammAtom( const MP4CammAtom &src );
+    MP4CammAtom &operator= ( const MP4CammAtom &src );
+};
+
 class MP4DrefAtom : public MP4Atom {
 public:
     MP4DrefAtom(MP4File &file);
diff --git a/src/mp4atom.cpp b/src/mp4atom.cpp
index 744c9e0..770f08f 100644
--- a/src/mp4atom.cpp
+++ b/src/mp4atom.cpp
@@ -831,6 +831,8 @@
             break;
 
         case 'c':
+            if( ATOMID(type) == ATOMID("camm") )
+                return new MP4CammAtom(file);
             if( ATOMID(type) == ATOMID("chap") )
                 return new MP4TrefTypeAtom( file, type );
             if( ATOMID(type) == ATOMID("chpl") )
diff --git a/src/mp4file.cpp b/src/mp4file.cpp
index 217e388..b26c3ec 100644
--- a/src/mp4file.cpp
+++ b/src/mp4file.cpp
@@ -1138,7 +1138,11 @@
 
     (void)InsertChildAtom(MakeTrackName(trackId, "mdia.minf"), "nmhd", 0);
 
-    (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"), "mp4s");
+    bool is_camm = strcmp(type, "camm") == 0;
+    const char *sample_entry = is_camm ? "camm" : "mp4s";
+
+    (void)AddChildAtom(MakeTrackName(trackId, "mdia.minf.stbl.stsd"),
+                       sample_entry);
 
     AddDescendantAtoms(MakeTrackName(trackId, NULL), "udta.name");
 
@@ -1150,6 +1154,10 @@
         (MP4Property**)&pStsdCountProperty);
     pStsdCountProperty->IncrementValue();
 
+    if (is_camm) {
+      return trackId;
+    }
+
     SetTrackIntegerProperty(trackId,
                             "mdia.minf.stbl.stsd.mp4s.esds.ESID",
                             0