OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. | 2 * Copyright (c) 2014 The WebM project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 #include "./webmenc.h" | 10 #include "./webmenc.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 info->set_writing_app(version.c_str()); | 42 info->set_writing_app(version.c_str()); |
43 | 43 |
44 const uint64_t video_track_id = | 44 const uint64_t video_track_id = |
45 segment->AddVideoTrack(static_cast<int>(cfg->g_w), | 45 segment->AddVideoTrack(static_cast<int>(cfg->g_w), |
46 static_cast<int>(cfg->g_h), | 46 static_cast<int>(cfg->g_h), |
47 kVideoTrackNumber); | 47 kVideoTrackNumber); |
48 mkvmuxer::VideoTrack* const video_track = | 48 mkvmuxer::VideoTrack* const video_track = |
49 static_cast<mkvmuxer::VideoTrack*>( | 49 static_cast<mkvmuxer::VideoTrack*>( |
50 segment->GetTrackByNumber(video_track_id)); | 50 segment->GetTrackByNumber(video_track_id)); |
51 video_track->SetStereoMode(stereo_fmt); | 51 video_track->SetStereoMode(stereo_fmt); |
52 video_track->set_codec_id(fourcc == VP8_FOURCC ? "V_VP8" : "V_VP9"); | 52 const char *codec_id; |
| 53 switch (fourcc) { |
| 54 case VP8_FOURCC: |
| 55 codec_id = "V_VP8"; |
| 56 break; |
| 57 case VP9_FOURCC: |
| 58 codec_id = "V_VP9"; |
| 59 break; |
| 60 case VP10_FOURCC: |
| 61 codec_id = "V_VP10"; |
| 62 break; |
| 63 default: |
| 64 codec_id = "V_VP10"; |
| 65 break; |
| 66 } |
| 67 video_track->set_codec_id(codec_id); |
53 if (par->numerator > 1 || par->denominator > 1) { | 68 if (par->numerator > 1 || par->denominator > 1) { |
54 // TODO(fgalligan): Add support of DisplayUnit, Display Aspect Ratio type | 69 // TODO(fgalligan): Add support of DisplayUnit, Display Aspect Ratio type |
55 // to WebM format. | 70 // to WebM format. |
56 const uint64_t display_width = | 71 const uint64_t display_width = |
57 static_cast<uint64_t>(((cfg->g_w * par->numerator * 1.0) / | 72 static_cast<uint64_t>(((cfg->g_w * par->numerator * 1.0) / |
58 par->denominator) + .5); | 73 par->denominator) + .5); |
59 video_track->set_display_width(display_width); | 74 video_track->set_display_width(display_width); |
60 video_track->set_display_height(cfg->g_h); | 75 video_track->set_display_height(cfg->g_h); |
61 } | 76 } |
62 if (glob->debug) { | 77 if (glob->debug) { |
(...skipping 25 matching lines...) Expand all Loading... |
88 mkvmuxer::MkvWriter *const writer = | 103 mkvmuxer::MkvWriter *const writer = |
89 reinterpret_cast<mkvmuxer::MkvWriter*>(glob->writer); | 104 reinterpret_cast<mkvmuxer::MkvWriter*>(glob->writer); |
90 mkvmuxer::Segment *const segment = | 105 mkvmuxer::Segment *const segment = |
91 reinterpret_cast<mkvmuxer::Segment*>(glob->segment); | 106 reinterpret_cast<mkvmuxer::Segment*>(glob->segment); |
92 segment->Finalize(); | 107 segment->Finalize(); |
93 delete segment; | 108 delete segment; |
94 delete writer; | 109 delete writer; |
95 glob->writer = NULL; | 110 glob->writer = NULL; |
96 glob->segment = NULL; | 111 glob->segment = NULL; |
97 } | 112 } |
OLD | NEW |