* 33 -> 34
* Content only contains audio/subtitle-related tags if those things
* are present.
+ * 34 -> 35
+ * VideoFrameType in VideoContent is a string rather than an integer.
*/
-int const Film::current_state_version = 34;
+int const Film::current_state_version = 35;
/** Construct a Film object in a given directory.
*
node->add_child("TopCrop")->add_child_text (raw_convert<string> (top));
node->add_child("BottomCrop")->add_child_text (raw_convert<string> (bottom));
}
+
+string
+video_frame_type_to_string (VideoFrameType t)
+{
+ switch (t) {
+ case VIDEO_FRAME_TYPE_2D:
+ return "2d";
+ case VIDEO_FRAME_TYPE_3D_LEFT_RIGHT:
+ return "3d-left-right";
+ case VIDEO_FRAME_TYPE_3D_TOP_BOTTOM:
+ return "3d-top-bottom";
+ case VIDEO_FRAME_TYPE_3D_ALTERNATE:
+ return "3d-alternate";
+ case VIDEO_FRAME_TYPE_3D_LEFT:
+ return "3d-left";
+ case VIDEO_FRAME_TYPE_3D_RIGHT:
+ return "3d-right";
+ default:
+ DCPOMATIC_ASSERT (false);
+ }
+
+ DCPOMATIC_ASSERT (false);
+}
+
+VideoFrameType
+string_to_video_frame_type (string s)
+{
+ if (s == "2d") {
+ return VIDEO_FRAME_TYPE_2D;
+ } else if (s == "3d-left-right") {
+ return VIDEO_FRAME_TYPE_3D_LEFT_RIGHT;
+ } else if (s == "3d-top-bottom") {
+ return VIDEO_FRAME_TYPE_3D_TOP_BOTTOM;
+ } else if (s == "3d-alternate") {
+ return VIDEO_FRAME_TYPE_3D_ALTERNATE;
+ } else if (s == "3d-left") {
+ return VIDEO_FRAME_TYPE_3D_LEFT;
+ } else if (s == "3d-right") {
+ return VIDEO_FRAME_TYPE_3D_RIGHT;
+ }
+
+ DCPOMATIC_ASSERT (false);
+}
VIDEO_FRAME_TYPE_3D_RIGHT
};
+std::string video_frame_type_to_string (VideoFrameType);
+VideoFrameType string_to_video_frame_type (std::string);
+
enum Eyes
{
EYES_BOTH,
}
_length = node->number_child<Frame> ("VideoLength");
- _frame_type = static_cast<VideoFrameType> (node->number_child<int> ("VideoFrameType"));
+
+ if (version <= 34) {
+ /* Snapshot of the VideoFrameType enum at version 34 */
+ switch (node->number_child<int> ("VideoFrameType")) {
+ case 0:
+ _frame_type = VIDEO_FRAME_TYPE_2D;
+ break;
+ case 1:
+ _frame_type = VIDEO_FRAME_TYPE_3D_LEFT_RIGHT;
+ break;
+ case 2:
+ _frame_type = VIDEO_FRAME_TYPE_3D_TOP_BOTTOM;
+ break;
+ case 3:
+ _frame_type = VIDEO_FRAME_TYPE_3D_ALTERNATE;
+ break;
+ case 4:
+ _frame_type = VIDEO_FRAME_TYPE_3D_LEFT;
+ break;
+ case 5:
+ _frame_type = VIDEO_FRAME_TYPE_3D_RIGHT;
+ break;
+ }
+ } else {
+ _frame_type = string_to_video_frame_type (node->string_child ("VideoFrameType"));
+ }
+
_sample_aspect_ratio = node->optional_number_child<double> ("SampleAspectRatio");
_crop.left = node->number_child<int> ("LeftCrop");
_crop.right = node->number_child<int> ("RightCrop");
node->add_child("VideoLength")->add_child_text (raw_convert<string> (_length));
node->add_child("VideoWidth")->add_child_text (raw_convert<string> (_size.width));
node->add_child("VideoHeight")->add_child_text (raw_convert<string> (_size.height));
- node->add_child("VideoFrameType")->add_child_text (raw_convert<string> (static_cast<int> (_frame_type)));
+ node->add_child("VideoFrameType")->add_child_text (video_frame_type_to_string (_frame_type));
if (_sample_aspect_ratio) {
node->add_child("SampleAspectRatio")->add_child_text (raw_convert<string> (_sample_aspect_ratio.get ()));
}