|
36 | 36 | using namespace std; |
37 | 37 | using namespace openshot; |
38 | 38 |
|
39 | | -TEST(FFmpegWriter_Test_Webm) |
| 39 | +SUITE(FFMpegWriter) { |
| 40 | +TEST(Webm) |
40 | 41 | { |
41 | 42 | // Reader |
42 | 43 | stringstream path; |
@@ -82,3 +83,46 @@ TEST(FFmpegWriter_Test_Webm) |
82 | 83 | CHECK_CLOSE(23, (int)pixels[pixel_index + 2], 5); |
83 | 84 | CHECK_CLOSE(255, (int)pixels[pixel_index + 3], 5); |
84 | 85 | } |
| 86 | + |
| 87 | +TEST(Options_Overloads) |
| 88 | +{ |
| 89 | + // Reader |
| 90 | + stringstream path; |
| 91 | + path << TEST_MEDIA_PATH << "sintel_trailer-720p.mp4"; |
| 92 | + FFmpegReader r(path.str()); |
| 93 | + r.Open(); |
| 94 | + |
| 95 | + /* WRITER ---------------- */ |
| 96 | + FFmpegWriter w("output1.mp4"); |
| 97 | + |
| 98 | + // Set options |
| 99 | + w.SetAudioOptions("aac", 48000, 192000); |
| 100 | + w.SetVideoOptions("libx264", Fraction(30,1), 1280, 720, 5000000); |
| 101 | + |
| 102 | + // Open writer |
| 103 | + w.Open(); |
| 104 | + |
| 105 | + // Write some frames |
| 106 | + w.WriteFrame(&r, 24, 50); |
| 107 | + |
| 108 | + // Close writer & reader |
| 109 | + w.Close(); |
| 110 | + r.Close(); |
| 111 | + |
| 112 | + FFmpegReader r1("output1.mp4"); |
| 113 | + r1.Open(); |
| 114 | + |
| 115 | + // Verify implied settings |
| 116 | + CHECK_EQUAL(true, r1.info.has_audio); |
| 117 | + CHECK_EQUAL(true, r1.info.has_video); |
| 118 | + |
| 119 | + CHECK_EQUAL(2, r1.GetFrame(1)->GetAudioChannelsCount()); |
| 120 | + CHECK_EQUAL(LAYOUT_STEREO, r1.info.channel_layout); |
| 121 | + |
| 122 | + CHECK_EQUAL(1, r1.info.pixel_ratio.num); |
| 123 | + CHECK_EQUAL(1, r1.info.pixel_ratio.den); |
| 124 | + CHECK_EQUAL(false, r1.info.interlaced_frame); |
| 125 | + CHECK_EQUAL(true, r1.info.top_field_first); |
| 126 | +} |
| 127 | + |
| 128 | +} // SUITE() |
0 commit comments