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

Side by Side Diff: services/media/framework_ffmpeg/ffmpeg_formatting.cc

Issue 1686363002: Motown: ffmpeg implementations of framework 'parts' (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Changed the way AVBuffer allocation/deallocation is done in the ffmpeg audio decoder. Created 4 years, 9 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <ostream>
6
7 #include "services/media/framework_ffmpeg/ffmpeg_formatting.h"
8 extern "C" {
9 #include "third_party/ffmpeg/libavformat/avformat.h"
10 #include "third_party/ffmpeg/libavformat/internal.h"
11 #include "third_party/ffmpeg/libavutil/dict.h"
12 }
13
14 namespace mojo {
15 namespace media {
16
17 const char* safe(const char* s) {
18 return s == nullptr ? "<nullptr>" : s;
19 }
20
21 std::ostream& operator<<(
22 std::ostream& os,
23 const struct AVCodecTag *const *value) {
24 if (value == nullptr) {
25 return os << "<nullptr>" << std::endl;
26 } else if (*value == nullptr) {
27 return os << "&<nullptr>" << std::endl;
28 } else {
29 os << std::endl;
30 }
31
32 os << indent;
33 os << begl << "AVCodecID id: " << (*value)->id << std::endl;
34 os << begl << "unsigned int tag: " << (*value)->tag << std::endl;
35 return os << outdent;
36 }
37
38 std::ostream& operator<<(std::ostream& os, const AVInputFormat *value) {
39 if (value == nullptr) {
40 return os << "<nullptr>" << std::endl;
41 } else {
42 os << std::endl;
43 }
44
45 os << indent;
46 os << begl << "const char *name: " << value->name << std::endl;
47 os << begl << "const char *long_name: " << value->long_name << std::endl;
48 os << begl << "int flags: " << AVFMTFlags(value->flags);
49 os << begl << "const char *extensions: " << safe(value->extensions)
50 << std::endl;
51 os << begl << "const AVCodecTag * const *codec_tag: " << value->codec_tag;
52 os << begl << "const char *mime_type: " << safe(value->mime_type)
53 << std::endl;
54 return os << outdent;
55 }
56
57 std::ostream& operator<<(std::ostream& os, const AVOutputFormat *value) {
58 if (value == nullptr) {
59 return os << "<nullptr>" << std::endl;
60 } else {
61 os << std::endl;
62 }
63
64 os << indent;
65 os << begl << "const char *name: " << safe(value->name) << std::endl;
66 os << begl << "const char *long_name: " << safe(value->long_name)
67 << std::endl;
68 os << begl << "const char *mime_type: " << safe(value->mime_type)
69 << std::endl;
70 os << begl << "const char *extensions: " << safe(value->extensions)
71 << std::endl;
72 os << begl << "AVCodecID audio_codec: " << value->audio_codec;
73 os << begl << "AVCodecID video_codec: " << value->video_codec;
74 os << begl << "AVCodecID subtitle_codec: " << value->subtitle_codec;
75 os << begl << "int flags: " << AVFMTFlags(value->flags);
76 os << begl << "const AVCodecTag * const *codec_tag: " << value->codec_tag;
77 return os << outdent;
78 }
79
80 std::ostream& operator<<(std::ostream& os, const AVIOContext *value) {
81 if (value == nullptr) {
82 return os << "<nullptr>" << std::endl;
83 } else {
84 return os << "TODO" << std::endl;
85 }
86 }
87
88 std::ostream& operator<<(std::ostream& os, AVFMTCTXFlags value) {
89 if (value.flags_ == 0) {
90 return os << "<none>" << std::endl;
91 }
92
93 if (value.flags_ & AVFMTCTX_NOHEADER) {
94 return os << "AVFMTCTX_NOHEADER" << std::endl;
95 } else {
96 return os << "<UNKNOWN AVFMTCTX_: " << value.flags_ << ">" << std::endl;
97 }
98 }
99
100 std::ostream& operator<<(std::ostream& os, const AVRational *value) {
101 if (value == nullptr) {
102 return os << "<none>" << std::endl;
103 } else {
104 os << std::endl;
105 }
106
107 os << indent;
108 for (int index = 0; value->num != 0 || value->den != 0; ++value, ++index) {
109 os << begl << "[" << index << "]: " << *value;
110 }
111 return os << outdent;
112 }
113
114 std::ostream& operator<<(std::ostream& os, const int *value) {
115 if (value == nullptr) {
116 return os << "<none>" << std::endl;
117 } else {
118 os << std::endl;
119 }
120
121 os << indent;
122 for (int index = 0; *value != 0; ++value, ++index) {
123 os << begl << "[" << index << "]: " << *value << std::endl;
124 }
125 return os << outdent;
126 }
127
128 std::ostream& operator<<(std::ostream& os, const uint64_t *value) {
129 if (value == nullptr) {
130 return os << "<none>" << std::endl;
131 } else {
132 os << std::endl;
133 }
134
135 os << indent;
136 for (int index = 0; *value != 0; ++value, ++index) {
137 os << begl << "[" << index << "]: " << *value << std::endl;
138 }
139 return os << outdent;
140 }
141
142 std::ostream& operator<<(std::ostream& os, const AVSampleFormat *value) {
143 if (value == nullptr) {
144 return os << "<none>" << std::endl;
145 } else {
146 os << std::endl;
147 }
148
149 os << indent;
150 for (int index = 0; int(*value) != 0; ++value, ++index) {
151 os << begl << "[" << index << "]: " << *value;
152 }
153 return os << outdent;
154 }
155
156 std::ostream& operator<<(std::ostream& os, const AVCodec *value) {
157 if (value == nullptr) {
158 return os << "<nullptr>" << std::endl;
159 } else {
160 os << std::endl;
161 }
162
163 os << indent;
164 os << begl << "const char *name: " << safe(value->name) << std::endl;
165 os << begl << "const char *long_name: " << safe(value->long_name)
166 << std::endl;
167 os << begl << "AVMediaType type: " << value->type;
168 os << begl << "AVCodecID id: " << value->id;
169 os << begl << "int capabilities: " << value->capabilities << std::endl;
170 os << begl << "AVRational *supported_framerates: "
171 << value->supported_framerates;
172 os << begl << "const int *supported_samplerates: "
173 << value->supported_samplerates;
174 os << begl << "const AVSampleFormat *sample_fmts: " << value->sample_fmts;
175 os << begl << "const uint64_t *channel_layouts: " << value->channel_layouts;
176
177 return os << outdent;
178 }
179
180 std::ostream& operator<<(std::ostream& os, const AVCodecContext *value) {
181 if (value == nullptr) {
182 return os << "<nullptr>" << std::endl;
183 } else {
184 os << std::endl;
185 }
186
187 os << indent;
188 os << begl << "AVMediaType codec_type: " << value->codec_type;
189 os << begl << "const struct AVCodec *codec: " << value->codec;
190 os << begl << "AVCodecID codec_id: " << value->codec_id;
191 os << begl << "int bit_rate: " << value->bit_rate << std::endl;
192 os << begl << "int extradata_size: " << value->extradata_size << std::endl;
193 os << begl << "int width: " << value->width << std::endl;
194 os << begl << "int height: " << value->height << std::endl;
195 os << begl << "int coded_width: " << value->coded_width << std::endl;
196 os << begl << "int coded_height: " << value->coded_height << std::endl;
197 os << begl << "int gop_size: " << value->gop_size << std::endl;
198 os << begl << "int sample_rate: " << value->sample_rate << std::endl;
199 os << begl << "int channels: " << value->channels << std::endl;
200 os << begl << "AVSampleFormat sample_fmt: " << value->sample_fmt;
201 os << begl << "int frame_size: " << value->frame_size << std::endl;
202 os << begl << "int frame_number: " << value->frame_number << std::endl;
203 os << begl << "int block_align: " << value->block_align << std::endl;
204 os << begl << "int cutoff: " << value->cutoff << std::endl;
205 os << begl << "uint64_t channel_layout: " << value->channel_layout
206 << std::endl;
207 os << begl << "uint64_t request_channel_layout: "
208 << value->request_channel_layout << std::endl;
209 os << begl << "AVAudioServiceType audio_service_type: "
210 << value->audio_service_type << std::endl;
211 os << begl << "AVSampleFormat request_sample_fmt: "
212 << value->request_sample_fmt;
213 os << begl << "int profile: " << value->profile << std::endl;
214 return os << outdent;
215 }
216
217 std::ostream& operator<<(std::ostream& os, const AVRational& value) {
218 return os << value.num << "/" << value.den << std::endl;
219 }
220
221 std::ostream& operator<<(std::ostream& os, const AVStream *value) {
222 if (value == nullptr) {
223 return os << "<nullptr>" << std::endl;
224 } else {
225 os << std::endl;
226 }
227
228 os << indent;
229 os << begl << "int index: " << value->index << std::endl;
230 os << begl << "int id: " << value->id << std::endl;
231 os << begl << "AVCodecContext *codec: " << value->codec;
232 os << begl << "AVRational time_base: " << value->time_base;
233 os << begl << "int64_t start_time: " << value->start_time << std::endl;
234 os << begl << "int64_t duration: " << value->duration << std::endl;
235 os << begl << "int64_t nb_frames: " << value->nb_frames << std::endl;
236 os << begl << "int disposition: " << AV_DISPOSITIONFlags(value->disposition);
237 os << begl << "AVDiscard discard: " << value->discard;
238 os << begl << "AVRational sample_aspect_ratio: "
239 << value->sample_aspect_ratio;
240 os << begl << "AVDictionary *metadata: " << value->metadata;
241 os << begl << "AVRational avg_frame_rate: " << value->avg_frame_rate;
242 os << begl << "AVPacket attached_pic: " << &value->attached_pic;
243 os << begl << "int nb_side_data: " << value->nb_side_data << std::endl;
244 os << begl << "AVPacketSideData side_data: " <<
245 AVPacketSideDataArray(value->side_data, value->nb_side_data);
246 os << begl << "int event_flags: " << AVSTREAM_EVENTFlags(value->event_flags);
247 return os << outdent;
248 }
249
250 std::ostream& operator<<(std::ostream& os, const AVStreamArray& value) {
251 if (value.items_ == nullptr) {
252 return os << "<nullptr>" << std::endl;
253 } else if (value.count_ == 0) {
254 return os << "<empty>" << std::endl;
255 } else {
256 os << std::endl;
257 }
258
259 os << indent;
260 for (unsigned int i = 0; i < value.count_; i++) {
261 os << begl << "[" << i << "] " << value.items_[i];
262 }
263 return os << outdent;
264 }
265
266 std::ostream& operator<<(std::ostream& os, AVFMTFlags value) {
267 if (value.flags_ == 0) {
268 os << "<none>" << std::endl;
269 return os;
270 } else {
271 os << std::endl;
272 }
273
274 os << indent;
275 if (value.flags_ & AVFMT_FLAG_GENPTS) {
276 os << begl << "AVFMT_FLAG_GENPTS" << std::endl;
277 }
278 if (value.flags_ & AVFMT_FLAG_IGNIDX) {
279 os << begl << "AVFMT_FLAG_IGNIDX" << std::endl;
280 }
281 if (value.flags_ & AVFMT_FLAG_NONBLOCK) {
282 os << begl << "AVFMT_FLAG_NONBLOCK" << std::endl;
283 }
284 if (value.flags_ & AVFMT_FLAG_IGNDTS) {
285 os << begl << "AVFMT_FLAG_IGNDTS" << std::endl;
286 }
287 if (value.flags_ & AVFMT_FLAG_NOFILLIN) {
288 os << begl << "AVFMT_FLAG_NOFILLIN" << std::endl;
289 }
290 if (value.flags_ & AVFMT_FLAG_NOPARSE) {
291 os << begl << "AVFMT_FLAG_NOPARSE" << std::endl;
292 }
293 if (value.flags_ & AVFMT_FLAG_NOBUFFER) {
294 os << begl << "AVFMT_FLAG_NOBUFFER" << std::endl;
295 }
296 if (value.flags_ & AVFMT_FLAG_CUSTOM_IO) {
297 os << begl << "AVFMT_FLAG_CUSTOM_IO" << std::endl;
298 }
299 if (value.flags_ & AVFMT_FLAG_DISCARD_CORRUPT) {
300 os << begl << "AVFMT_FLAG_DISCARD_CORRUPT" << std::endl;
301 }
302 if (value.flags_ & AVFMT_FLAG_FLUSH_PACKETS) {
303 os << begl << "AVFMT_FLAG_FLUSH_PACKETS" << std::endl;
304 }
305 if (value.flags_ & AVFMT_FLAG_BITEXACT) {
306 os << begl << "AVFMT_FLAG_BITEXACT" << std::endl;
307 }
308 if (value.flags_ & AVFMT_FLAG_MP4A_LATM) {
309 os << begl << "AVFMT_FLAG_MP4A_LATM" << std::endl;
310 }
311 if (value.flags_ & AVFMT_FLAG_SORT_DTS) {
312 os << begl << "AVFMT_FLAG_SORT_DTS" << std::endl;
313 }
314 if (value.flags_ & AVFMT_FLAG_PRIV_OPT) {
315 os << begl << "AVFMT_FLAG_PRIV_OPT" << std::endl;
316 }
317 if (value.flags_ & AVFMT_FLAG_KEEP_SIDE_DATA) {
318 os << begl << "AVFMT_FLAG_KEEP_SIDE_DATA" << std::endl;
319 }
320 if (value.flags_ & AVFMT_FLAG_FAST_SEEK) {
321 os << begl << "AVFMT_FLAG_FAST_SEEK" << std::endl;
322 }
323 return os << outdent;
324 }
325
326 std::ostream& operator<<(std::ostream& os, AV_DISPOSITIONFlags value) {
327 if (value.flags_ == 0) {
328 os << "<none>" << std::endl;
329 return os;
330 } else {
331 os << std::endl;
332 }
333
334 os << indent;
335 if (value.flags_ & AV_DISPOSITION_DEFAULT) {
336 os << begl << "AV_DISPOSITION_DEFAULT 0x0001" << std::endl;
337 }
338 if (value.flags_ & AV_DISPOSITION_DUB) {
339 os << begl << "AV_DISPOSITION_DUB 0x0002" << std::endl;
340 }
341 if (value.flags_ & AV_DISPOSITION_ORIGINAL) {
342 os << begl << "AV_DISPOSITION_ORIGINAL 0x0004" << std::endl;
343 }
344 if (value.flags_ & AV_DISPOSITION_COMMENT) {
345 os << begl << "AV_DISPOSITION_COMMENT 0x0008" << std::endl;
346 }
347 if (value.flags_ & AV_DISPOSITION_LYRICS) {
348 os << begl << "AV_DISPOSITION_LYRICS 0x0010" << std::endl;
349 }
350 if (value.flags_ & AV_DISPOSITION_KARAOKE) {
351 os << begl << "AV_DISPOSITION_KARAOKE 0x0020" << std::endl;
352 }
353 return os << outdent;
354 }
355
356 std::ostream& operator<<(std::ostream& os, const AVBufferRef *value) {
357 if (value == nullptr) {
358 return os << "<nullptr>" << std::endl;
359 } else {
360 os << std::endl;
361 }
362
363 os << indent;
364 os << begl << "AVBuffer *buffer: "
365 << (value->buffer == nullptr ? "<nullptr>" : "TODO") << std::endl;
366 os << begl << "uint8_t *data: "
367 << (value->data == nullptr ? "<nullptr>" : "<opaque>") << std::endl;
368 os << begl << "int size: " << value->size << std::endl;
369 return os << outdent;
370 }
371
372 std::ostream& operator<<(std::ostream& os, const AVFrame *value) {
373 if (value == nullptr) {
374 return os << "<nullptr>" << std::endl;
375 } else {
376 os << std::endl;
377 }
378
379 os << indent;
380 os << begl << "uint8_t *data[AV_NUM_DATA_POINTERS]: ";
381 {
382 os << indent;
383 bool any = false;
384 for (int i = 0; i < AV_NUM_DATA_POINTERS; i++) {
385 if (value->data[i] != nullptr) {
386 if (!any) {
387 any = true;
388 os << std::endl;
389 }
390 os << begl << "[" << i << "]: <opaque>" << std::endl;
391 }
392 }
393 if (!any) {
394 os << "<all nullptr>" << std::endl;
395 }
396 os << outdent;
397 }
398
399 os << begl << "int linesize[AV_NUM_DATA_POINTERS]: ";
400 {
401 os << indent;
402 bool any = false;
403 for (int i = 0; i < AV_NUM_DATA_POINTERS; i++) {
404 if (value->linesize[i] != 0) {
405 if (!any) {
406 any = true;
407 os << std::endl;
408 }
409 os << begl << "[" << i << "]: " << value->linesize[i] << std::endl;
410 }
411 }
412 if (!any) {
413 os << "<all zero>" << std::endl;
414 }
415 os << outdent;
416 }
417
418 os << begl << "uint8_t **extended_data: "
419 << (value->extended_data == nullptr ? "<nullptr>" : "<opaque>")
420 << std::endl;
421 os << begl << "int width: " << value->width << std::endl;
422 os << begl << "int height: " << value->height << std::endl;
423 os << begl << "int nb_samples: " << value->nb_samples << std::endl;
424 os << begl << "int format: " << value->format << std::endl;
425 os << begl << "int key_frame: " << value->key_frame << std::endl;
426 os << begl << "int64_t pts: " << value->pts << std::endl;
427 os << begl << "int64_t pkt_pts: " << value->pkt_pts << std::endl;
428 os << begl << "int64_t pkt_dts: " << value->pkt_dts << std::endl;
429 os << begl << "int sample_rate: " << value->sample_rate << std::endl;
430 os << begl << "AVBufferRef *buf[AV_NUM_DATA_POINTERS]: ";
431 {
432 os << indent;
433 bool any = false;
434 for (int i = 0; i < AV_NUM_DATA_POINTERS; i++) {
435 if (value->buf[i] != nullptr) {
436 if (!any) {
437 any = true;
438 os << std::endl;
439 }
440 os << begl << "[" << i << "]:" << value->buf[i];
441 }
442 }
443 if (!any) {
444 os << "<all nullptr>" << std::endl;
445 }
446 os << outdent;
447 }
448 os << begl << "int channels: " << value->channels << std::endl;
449 os << begl << "int pkt_size: " << value->pkt_size << std::endl;
450 return os << outdent;
451 }
452
453 std::ostream& operator<<(std::ostream& os, const AVPacket *value) {
454 if (value == nullptr) {
455 return os << "<nullptr>" << std::endl;
456 } else {
457 os << std::endl;
458 }
459
460 os << indent;
461 os << begl << "AVBufferRef *buf: " << value->buf;
462 os << begl << "int64_t pts: " << value->pts << std::endl;
463 os << begl << "int64_t dts: " << value->dts << std::endl;
464 os << begl << "uint8_t *data: "
465 << (value->data == nullptr ? "<nullptr>" : "<opaque>") << std::endl;
466 os << begl << "int size: " << value->size << std::endl;
467 os << begl << "int stream_index: " << value->stream_index << std::endl;
468 os << begl << "int flags: " << value->flags << std::endl;
469 os << begl << "AVPacketSideData *side_data: " << value->side_data;
470 os << begl << "int side_data_elems: " << value->side_data_elems << std::endl;
471 os << begl << "int duration: " << value->duration << std::endl;
472 os << begl << "int64_t pos: " << value->pos << std::endl;
473 os << begl << "int64_t convergence_duration: "
474 << value->convergence_duration << std::endl;
475 return os << outdent;
476 }
477
478 std::ostream& operator<<(std::ostream& os, const AVPacketSideData *value) {
479 if (value == nullptr) {
480 return os << "<nullptr>" << std::endl;
481 } else {
482 return os << "TODO" << std::endl;
483 }
484 }
485
486 std::ostream& operator<<(std::ostream& os, const AVPacketSideDataArray& value) {
487 if (value.items_ == nullptr) {
488 return os << "<nullptr>" << std::endl;
489 } else if (value.count_ == 0) {
490 return os << "<empty>" << std::endl;
491 } else {
492 os << std::endl;
493 }
494
495 os << indent;
496 for (unsigned int i = 0; i < value.count_; i++) {
497 os << begl << "[" << i << "] " << &value.items_[i];
498 }
499 return os << outdent;
500 }
501
502 std::ostream& operator<<(std::ostream& os, const AVProgram *value) {
503 if (value == nullptr) {
504 return os << "<nullptr>" << std::endl;
505 } else {
506 return os << "TODO" << std::endl;
507 }
508 }
509
510 std::ostream& operator<<(std::ostream& os, const AVProgramArray& value) {
511 if (value.items_ == nullptr) {
512 return os << "<nullptr>" << std::endl;
513 } else if (value.count_ == 0) {
514 return os << "<empty>" << std::endl;
515 } else {
516 os << std::endl;
517 }
518
519 os << indent;
520 for (unsigned int i = 0; i < value.count_; i++) {
521 os << begl << "[" << i << "]" << value.items_[i];
522 }
523 return os << outdent;
524 }
525
526 std::ostream& operator<<(std::ostream& os, const AVChapter *value) {
527 if (value == nullptr) {
528 return os << "<nullptr>" << std::endl;
529 } else {
530 return os << "TODO" << std::endl;
531 }
532 }
533
534 std::ostream& operator<<(std::ostream& os, const AVChapterArray& value) {
535 if (value.items_ == nullptr) {
536 return os << "<nullptr>" << std::endl;
537 } else if (value.count_ == 0) {
538 return os << "<empty>" << std::endl;
539 } else {
540 os << std::endl;
541 }
542
543 os << indent;
544 for (unsigned int i = 0; i < value.count_; i++) {
545 os << begl << "[" << i << "]" << value.items_[i];
546 }
547 return os << outdent;
548 }
549
550 std::ostream& operator<<(std::ostream& os, AVCodecID value) {
551 return os << avcodec_get_name(value) << " (" << static_cast<int>(value) << ")"
552 << std::endl;
553 }
554
555 std::ostream& operator<<(std::ostream& os, const AVDictionary *value) {
556 if (value == nullptr) {
557 return os << "<nullptr>" << std::endl;
558 }
559 AVDictionaryEntry *entry =
560 av_dict_get(value, "", nullptr, AV_DICT_IGNORE_SUFFIX);
561 if (entry == nullptr) {
562 return os << "<empty>" << std::endl;
563 }
564 os << std::endl;
565
566 os << indent;
567 while (entry != nullptr) {
568 os << begl << safe(entry->key) << ": " << safe(entry->value) << std::endl;
569 entry = av_dict_get(value, "", entry, AV_DICT_IGNORE_SUFFIX);
570 }
571 return os << outdent;
572 }
573
574 std::ostream& operator<<(std::ostream& os, AVFMT_EVENTFlags value) {
575 if (value.flags_ == 0) {
576 os << "<none>" << std::endl;
577 return os;
578 }
579
580 if (value.flags_ & AVFMT_EVENT_FLAG_METADATA_UPDATED) {
581 return os << "AVFMT_EVENT_FLAG_METADATA_UPDATED" << std::endl;
582 } else {
583 return os << "<UNKNOWN AVFMT_EVENT_FLAG_: " << value.flags_ << ">"
584 << std::endl;
585 }
586 }
587
588 std::ostream& operator<<(std::ostream& os, AVSTREAM_EVENTFlags value) {
589 if (value.flags_ == 0) {
590 os << "<none>" << std::endl;
591 return os;
592 }
593
594 if (value.flags_ & AVSTREAM_EVENT_FLAG_METADATA_UPDATED) {
595 return os << "AVSTREAM_EVENT_FLAG_METADATA_UPDATED" << std::endl;
596 } else {
597 return os << "<UNKNOWN AVSTREAM_EVENT_FLAG_: " << value.flags_ << ">"
598 << std::endl;
599 }
600 }
601
602 std::ostream& operator<<(std::ostream& os, AVFMT_AVOID_NEG_TSFlags value) {
603 switch (value.flags_) {
604 case AVFMT_AVOID_NEG_TS_AUTO:
605 return os << "AVFMT_AVOID_NEG_TS_AUTO" << std::endl;
606 case AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE:
607 return os << "AVFMT_AVOID_NEG_TS_MAKE_NON_NEGATIVE" << std::endl;
608 case AVFMT_AVOID_NEG_TS_MAKE_ZERO:
609 return os << "AVFMT_AVOID_NEG_TS_MAKE_ZERO" << std::endl;
610 default:
611 return os << "<UNKNOWN AVFMT_AVOID_NEG_TS_: " << value.flags_ << ">"
612 << std::endl;
613 }
614 }
615
616 std::ostream& operator<<(std::ostream& os, AVMediaType value) {
617 switch (value) {
618 case AVMEDIA_TYPE_UNKNOWN:
619 return os << "AVMEDIA_TYPE_UNKNOWN" << std::endl;
620 case AVMEDIA_TYPE_VIDEO:
621 return os << "AVMEDIA_TYPE_VIDEO" << std::endl;
622 case AVMEDIA_TYPE_AUDIO:
623 return os << "AVMEDIA_TYPE_AUDIO" << std::endl;
624 case AVMEDIA_TYPE_DATA:
625 return os << "AVMEDIA_TYPE_DATA" << std::endl;
626 case AVMEDIA_TYPE_SUBTITLE:
627 return os << "AVMEDIA_TYPE_SUBTITLE" << std::endl;
628 case AVMEDIA_TYPE_ATTACHMENT:
629 return os << "AVMEDIA_TYPE_ATTACHMENT" << std::endl;
630 case AVMEDIA_TYPE_NB:
631 return os << "AVMEDIA_TYPE_NB" << std::endl;
632 default:
633 return os << "<UNKNOWN AVMediaType: " << static_cast<int>(value) << ">"
634 << std::endl;
635 }
636 }
637
638 std::ostream& operator<<(std::ostream& os, AVSampleFormat value) {
639 switch (value) {
640 case AV_SAMPLE_FMT_NONE:
641 return os << "AV_SAMPLE_FMT_NONE" << std::endl;
642 case AV_SAMPLE_FMT_U8:
643 return os << "AV_SAMPLE_FMT_U8" << std::endl;
644 case AV_SAMPLE_FMT_S16:
645 return os << "AV_SAMPLE_FMT_S16" << std::endl;
646 case AV_SAMPLE_FMT_S32:
647 return os << "AV_SAMPLE_FMT_S32" << std::endl;
648 case AV_SAMPLE_FMT_FLT:
649 return os << "AV_SAMPLE_FMT_FLT" << std::endl;
650 case AV_SAMPLE_FMT_DBL:
651 return os << "AV_SAMPLE_FMT_DBL" << std::endl;
652 case AV_SAMPLE_FMT_U8P:
653 return os << "AV_SAMPLE_FMT_U8P" << std::endl;
654 case AV_SAMPLE_FMT_S16P:
655 return os << "AV_SAMPLE_FMT_S16P" << std::endl;
656 case AV_SAMPLE_FMT_S32P:
657 return os << "AV_SAMPLE_FMT_S32P" << std::endl;
658 case AV_SAMPLE_FMT_FLTP:
659 return os << "AV_SAMPLE_FMT_FLTP" << std::endl;
660 case AV_SAMPLE_FMT_DBLP:
661 return os << "AV_SAMPLE_FMT_DBLP" << std::endl;
662 case AV_SAMPLE_FMT_NB:
663 return os << "AV_SAMPLE_FMT_NB" << std::endl;
664 default:
665 return os << "<UNKNOWN AVSampleFormat: " << static_cast<int>(value) << ">"
666 << std::endl;
667 }
668 }
669
670 std::ostream& operator<<(std::ostream& os, AVColorSpace value) {
671 switch (value) {
672 case AVCOL_SPC_RGB:
673 return os << "AVCOL_SPC_RGB" << std::endl;
674 case AVCOL_SPC_BT709:
675 return os << "AVCOL_SPC_BT709" << std::endl;
676 case AVCOL_SPC_UNSPECIFIED:
677 return os << "AVCOL_SPC_UNSPECIFIED" << std::endl;
678 case AVCOL_SPC_RESERVED:
679 return os << "AVCOL_SPC_RESERVED" << std::endl;
680 case AVCOL_SPC_FCC:
681 return os << "AVCOL_SPC_FCC" << std::endl;
682 case AVCOL_SPC_BT470BG:
683 return os << "AVCOL_SPC_BT470BG" << std::endl;
684 case AVCOL_SPC_SMPTE170M:
685 return os << "AVCOL_SPC_SMPTE170M" << std::endl;
686 case AVCOL_SPC_SMPTE240M:
687 return os << "AVCOL_SPC_SMPTE240M" << std::endl;
688 case AVCOL_SPC_YCOCG:
689 return os << "AVCOL_SPC_YCOCG" << std::endl;
690 case AVCOL_SPC_BT2020_NCL:
691 return os << "AVCOL_SPC_BT2020_NCL" << std::endl;
692 case AVCOL_SPC_BT2020_CL:
693 return os << "AVCOL_SPC_BT2020_CL" << std::endl;
694 case AVCOL_SPC_NB:
695 return os << "AVCOL_SPC_NB" << std::endl;
696 default:
697 return os << "<UNKNOWN AVColorSpace: " << static_cast<int>(value) << ">"
698 << std::endl;
699 }
700 }
701
702 std::ostream& operator<<(std::ostream& os, enum AVDiscard value) {
703 switch (value) {
704 case AVDISCARD_NONE:
705 return os << "AVDISCARD_NONE" << std::endl;
706 case AVDISCARD_DEFAULT:
707 return os << "AVDISCARD_DEFAULT" << std::endl;
708 case AVDISCARD_NONREF:
709 return os << "AVDISCARD_NONREF" << std::endl;
710 case AVDISCARD_BIDIR:
711 return os << "AVDISCARD_BIDIR" << std::endl;
712 case AVDISCARD_NONINTRA:
713 return os << "AVDISCARD_NONINTRA" << std::endl;
714 case AVDISCARD_NONKEY:
715 return os << "AVDISCARD_NONKEY" << std::endl;
716 case AVDISCARD_ALL:
717 return os << "AVDISCARD_ALL" << std::endl;
718 default:
719 return os << "<UNKNOWN AVDISCARD_: " << static_cast<int>(value) << ">"
720 << std::endl;
721 }
722 }
723
724 std::ostream& operator<<(std::ostream& os, AVDurationEstimationMethod value) {
725 switch (value) {
726 case AVFMT_DURATION_FROM_PTS:
727 return os << "AVFMT_DURATION_FROM_PTS" << std::endl;
728 case AVFMT_DURATION_FROM_STREAM:
729 return os << "AVFMT_DURATION_FROM_STREAM" << std::endl;
730 case AVFMT_DURATION_FROM_BITRATE:
731 return os << "AVFMT_DURATION_FROM_BITRATE" << std::endl;
732 default:
733 return os << "<UNKNOWN AVDurationEstimationMethod: "
734 << static_cast<int>(value) << ">" << std::endl;
735 }
736 }
737
738 std::ostream& operator<<(std::ostream& os, const AVFormatContext *value) {
739 if (value == nullptr) {
740 return os << "<nullptr>" << std::endl;
741 } else {
742 os << std::endl;
743 }
744
745 os << indent;
746 os << begl << "AVInputFormat *iformat: " << value->iformat;
747 os << begl << "AVOutputFormat *oformat: " << value->oformat;
748 os << begl << "AVIOContext *pb: " << value->pb;
749 os << begl << "int ctx_flags: " << AVFMTCTXFlags(value->ctx_flags);
750 os << begl << "unsigned int nb_streams: " << value->nb_streams << std::endl;
751 os << begl << "AVStream **streams: "
752 << AVStreamArray(value->streams, value->nb_streams);
753 os << begl << "char filename[1024]: " << value->filename << std::endl;
754 os << begl << "int64_t start_time: " << value->start_time << std::endl;
755 os << begl << "int64_t duration: " << value->duration << std::endl;
756 os << begl << "int64_t bit_rate: " << value->bit_rate << std::endl;
757 os << begl << "unsigned int packet_size: " << value->packet_size << std::endl;
758 os << begl << "int max_delay: " << value->max_delay << std::endl;
759 os << begl << "int flags: " << AVFMTFlags(value->flags);
760 os << begl << "int64_t probesize: " << value->probesize << std::endl;
761 os << begl << "unsigned int nb_programs: " << value->nb_programs << std::endl;
762 os << begl << "AVProgram **programs: "
763 << AVProgramArray(value->programs, value->nb_programs);
764 os << begl << "AVCodecID video_codec_id: " << value->video_codec_id;
765 os << begl << "AVCodecID audio_codec_id: " << value->audio_codec_id;
766 os << begl << "AVCodecID subtitle_codec_id: " << value->subtitle_codec_id;
767 os << begl << "unsigned int max_index_size: "
768 << value->max_index_size << std::endl;
769 os << begl << "unsigned int max_picture_buffer: "
770 << value->max_picture_buffer << std::endl;
771 os << begl << "unsigned int nb_chapters: " << value->nb_chapters << std::endl;
772 os << begl << "AVChapter **chapters: "
773 << AVChapterArray(value->chapters, value->nb_chapters);
774 os << begl << "AVDictionary *metadata: " << value->metadata;
775 os << begl << "int64_t start_time_realtime: " << value->start_time_realtime
776 << std::endl;
777 os << begl << "int fps_probe_size: " << value->fps_probe_size << std::endl;
778 os << begl << "int error_recognition: "
779 << value->error_recognition << std::endl;
780 os << begl << "int64_t max_interleave_delta: "
781 << value->max_interleave_delta << std::endl;
782 os << begl << "int strict_std_compliance: "
783 << value->strict_std_compliance << std::endl;
784 os << begl << "int event_flags: " << AVFMT_EVENTFlags(value->flags);
785 os << begl << "int max_ts_probe: " << value->max_ts_probe << std::endl;
786 os << begl << "int avoid_negative_ts: "
787 << AVFMT_AVOID_NEG_TSFlags(value->avoid_negative_ts);
788 os << begl << "int ts_id: " << value->ts_id << std::endl;
789 os << begl << "int audio_preload: " << value->audio_preload << std::endl;
790 os << begl << "int max_chunk_duration: "
791 << value->max_chunk_duration << std::endl;
792 os << begl << "int max_chunk_size: " << value->max_chunk_size << std::endl;
793 os << begl << "int use_wallclock_as_timestamps: "
794 << value->use_wallclock_as_timestamps << std::endl;
795 os << begl << "int avio_flags: " << value->avio_flags << std::endl;
796 os << begl << "AVDurationEstimationMethod duration_estimation_method: "
797 << value->duration_estimation_method;
798 os << begl << "int64_t skip_initial_bytes: " << value->skip_initial_bytes
799 << std::endl;
800 os << begl << "TODO(dalesat): more" << std::endl;
801 return os << outdent;
802 }
803
804 } // namespace media
805 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698