Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Side by Side Diff: media/cast/test/utility/generate_barcode_video.cc

Issue 248083005: Reland: [Cast] Consolidate plethora of GYP files into cast.gyp and cast_testing.gypi. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes to problems exposed by r265481. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <cstdio> 5 #include <cstdio>
6 #include <cstdlib> 6 #include <cstdlib>
7 7
8 #include "base/logging.h"
8 #include "media/base/video_frame.h" 9 #include "media/base/video_frame.h"
9 #include "media/cast/test/utility/barcode.h" 10 #include "media/cast/test/utility/barcode.h"
10 11
11 void DumpPlane(scoped_refptr<media::VideoFrame> frame, 12 void DumpPlane(scoped_refptr<media::VideoFrame> frame,
12 int plane) { 13 int plane) {
13 for (int row = 0; row < frame->rows(plane); row++) { 14 for (int row = 0; row < frame->rows(plane); row++) {
14 CHECK_EQ(frame->row_bytes(plane), 15 CHECK_EQ(static_cast<size_t>(frame->row_bytes(plane)),
15 fwrite(frame->data(plane) + frame->stride(plane) * row, 16 fwrite(frame->data(plane) + frame->stride(plane) * row,
16 1, 17 1,
17 frame->row_bytes(plane), 18 frame->row_bytes(plane),
18 stdout)); 19 stdout));
19 } 20 }
20 } 21 }
21 22
22 int main(int argc, char **argv) { 23 int main(int argc, char **argv) {
23 if (argc < 5) { 24 if (argc < 5) {
24 fprintf(stderr, "Usage: generate_barcode_video " 25 fprintf(stderr, "Usage: generate_barcode_video "
25 "<width> <height> <fps> <frames> >output.y4m\n"); 26 "<width> <height> <fps> <frames> >output.y4m\n");
26 exit(1); 27 exit(1);
27 } 28 }
28 int width = atoi(argv[1]); 29 int width = atoi(argv[1]);
29 int height = atoi(argv[2]); 30 int height = atoi(argv[2]);
30 int fps = atoi(argv[3]); 31 int fps = atoi(argv[3]);
31 uint16 wanted_frames = atoi(argv[4]); 32 uint16 wanted_frames = atoi(argv[4]);
32 scoped_refptr<media::VideoFrame> frame = 33 scoped_refptr<media::VideoFrame> frame =
33 media::VideoFrame::CreateBlackFrame(gfx::Size(width, height)); 34 media::VideoFrame::CreateBlackFrame(gfx::Size(width, height));
34 printf("YUV4MPEG2 W%d H%d F%d:1 Ip C420mpeg2\n", width, height, fps); 35 printf("YUV4MPEG2 W%d H%d F%d:1 Ip C420mpeg2\n", width, height, fps);
35 for (uint16 frame_id = 1; frame_id <= wanted_frames; frame_id++) { 36 for (uint16 frame_id = 1; frame_id <= wanted_frames; frame_id++) {
36 CHECK(media::cast::test::EncodeBarcode(frame_id, frame)); 37 CHECK(media::cast::test::EncodeBarcode(frame_id, frame));
37 printf("FRAME\n"); 38 printf("FRAME\n");
38 DumpPlane(frame, media::VideoFrame::kYPlane); 39 DumpPlane(frame, media::VideoFrame::kYPlane);
39 DumpPlane(frame, media::VideoFrame::kUPlane); 40 DumpPlane(frame, media::VideoFrame::kUPlane);
40 DumpPlane(frame, media::VideoFrame::kVPlane); 41 DumpPlane(frame, media::VideoFrame::kVPlane);
41 } 42 }
42 } 43 }
OLDNEW
« no previous file with comments | « media/cast/rtp_receiver/rtp_receiver.gyp ('k') | media/cast/test/utility/generate_timecode_audio.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698