1 /* 2 * Copyright (c) 1999-2000, Eric Moon. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 9 * 1. Redistributions of source code must retain the above copyright 10 * notice, this list of conditions, and the following disclaimer. 11 * 12 * 2. Redistributions in binary form must reproduce the above copyright 13 * notice, this list of conditions, and the following disclaimer in the 14 * documentation and/or other materials provided with the distribution. 15 * 16 * 3. The name of the author may not be used to endorse or promote products 17 * derived from this software without specific prior written permission. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR 20 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 21 * OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 23 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 26 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR 27 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31 32 // MediaString.cpp 33 34 #include "MediaString.h" 35 36 // Media Kit 37 #include <MediaFormats.h> 38 // Support Kit 39 #include <String.h> 40 41 #include <Catalog.h> 42 43 __USE_CORTEX_NAMESPACE 44 45 #include <Debug.h> 46 #define D_METHOD(x) //PRINT (x) 47 48 static BCatalog sCatalog("application/Haiku-cortex-support"); 49 50 // -------------------------------------------------------- // 51 // *** media_node strings (public) 52 // -------------------------------------------------------- // 53 54 BString MediaString::getStringFor( 55 node_kind kinds, 56 bool complete) { 57 D_METHOD(("MediaString::getStringFor(node_kind)\n")); 58 59 BString list, last; 60 bool first = true; 61 62 if (kinds & B_BUFFER_PRODUCER) { 63 if (first) { 64 list = sCatalog.GetString(B_TRANSLATE_MARK("Buffer producer")); 65 first = false; 66 } 67 } 68 if (kinds & B_BUFFER_CONSUMER) { 69 if (first) { 70 list = sCatalog.GetString(B_TRANSLATE_MARK("Buffer consumer")); 71 first = false; 72 } 73 else { 74 if (last != "") 75 list << ", " << last; 76 last = sCatalog.GetString(B_TRANSLATE_MARK("Buffer consumer")); 77 } 78 } 79 if (kinds & B_TIME_SOURCE) { 80 if (first) { 81 list = sCatalog.GetString(B_TRANSLATE_MARK("Time source")); 82 first = false; 83 } 84 else { 85 if (last != "") 86 list << ", " << last; 87 last = sCatalog.GetString(B_TRANSLATE_MARK("Time source")); 88 } 89 } 90 if (kinds & B_CONTROLLABLE) { 91 if (first) { 92 list = sCatalog.GetString(B_TRANSLATE_MARK("Controllable")); 93 first = false; 94 } 95 else { 96 if (last != "") 97 list << ", " << last; 98 last = sCatalog.GetString(B_TRANSLATE_MARK("Controllable")); 99 } 100 } 101 if (kinds & B_FILE_INTERFACE) { 102 if (first) { 103 list = sCatalog.GetString(B_TRANSLATE_MARK("File interface")); 104 first = false; 105 } 106 else { 107 if (last != "") 108 list << ", " << last; 109 last = sCatalog.GetString(B_TRANSLATE_MARK("File interface")); 110 } 111 } 112 if (kinds & B_ENTITY_INTERFACE) { 113 if (first) { 114 list = sCatalog.GetString(B_TRANSLATE_MARK("Entity interface")); 115 first = false; 116 } 117 else { 118 if (last != "") 119 list << ", " << last; 120 last = sCatalog.GetString(B_TRANSLATE_MARK("Entity interface")); 121 } 122 } 123 if (kinds & B_PHYSICAL_INPUT) { 124 if (first) { 125 list = sCatalog.GetString(B_TRANSLATE_MARK("Physical input")); 126 first = false; 127 } 128 else { 129 if (last != "") 130 list << ", " << last; 131 last = sCatalog.GetString(B_TRANSLATE_MARK("Physical input")); 132 } 133 } 134 if (kinds & B_PHYSICAL_OUTPUT) { 135 if (first) { 136 list = sCatalog.GetString(B_TRANSLATE_MARK("Physical output")); 137 first = false; 138 } 139 else { 140 if (last != "") 141 list << ", " << last; 142 last = sCatalog.GetString(B_TRANSLATE_MARK("Physical output")); 143 } 144 } 145 if (kinds & B_SYSTEM_MIXER) { 146 if (first) { 147 list = sCatalog.GetString(B_TRANSLATE_MARK("System mixer")); 148 first = false; 149 } 150 else { 151 if (last != "") 152 list << ", " << last; 153 last = sCatalog.GetString(B_TRANSLATE_MARK("System mixer")); 154 } 155 } 156 157 if (last != "") 158 list << " & " << last; 159 return list; 160 } 161 162 BString MediaString::getStringFor( 163 BMediaNode::run_mode runMode, 164 bool complete) 165 { 166 D_METHOD(("MediaString::getStringFor(run_mode)\n")); 167 168 switch (runMode) { 169 case BMediaNode::B_OFFLINE: 170 return sCatalog.GetString(B_TRANSLATE_MARK("Offline")); 171 case BMediaNode::B_RECORDING: 172 return sCatalog.GetString(B_TRANSLATE_MARK("Recording")); 173 case BMediaNode::B_DECREASE_PRECISION: 174 return sCatalog.GetString(B_TRANSLATE_MARK("Decrease precision")); 175 case BMediaNode::B_INCREASE_LATENCY: 176 return sCatalog.GetString(B_TRANSLATE_MARK("Increase latency")); 177 case BMediaNode::B_DROP_DATA: 178 return sCatalog.GetString(B_TRANSLATE_MARK("Drop data")); 179 default: 180 return sCatalog.GetString(B_TRANSLATE_MARK("(unknown run mode)")); 181 } 182 } 183 184 // -------------------------------------------------------- // 185 // *** media_format strings (public) 186 // -------------------------------------------------------- // 187 188 BString MediaString::getStringFor( 189 media_type type, 190 bool complete) { 191 D_METHOD(("MediaString::getStringFor(media_type)\n")); 192 193 switch (type) { 194 case B_MEDIA_NO_TYPE: 195 return sCatalog.GetString(B_TRANSLATE_MARK("Typeless media")); 196 case B_MEDIA_UNKNOWN_TYPE: 197 return sCatalog.GetString(B_TRANSLATE_MARK("Unknown media type")); 198 case B_MEDIA_RAW_AUDIO: 199 return sCatalog.GetString(B_TRANSLATE_MARK("Raw audio")); 200 case B_MEDIA_RAW_VIDEO: 201 return sCatalog.GetString(B_TRANSLATE_MARK("Raw video")); 202 case B_MEDIA_VBL: 203 return sCatalog.GetString(B_TRANSLATE_MARK("Raw data from VBL area")); 204 case B_MEDIA_TIMECODE: 205 return sCatalog.GetString(B_TRANSLATE_MARK("Timecode")); 206 case B_MEDIA_MIDI: 207 return sCatalog.GetString(B_TRANSLATE_MARK("MIDI")); 208 case B_MEDIA_TEXT: 209 return sCatalog.GetString(B_TRANSLATE_MARK("Text")); 210 case B_MEDIA_HTML: 211 return sCatalog.GetString(B_TRANSLATE_MARK("HTML")); 212 case B_MEDIA_MULTISTREAM: 213 return sCatalog.GetString(B_TRANSLATE_MARK("Multistream media")); 214 case B_MEDIA_PARAMETERS: 215 return sCatalog.GetString(B_TRANSLATE_MARK("Parameters")); 216 case B_MEDIA_ENCODED_AUDIO: 217 return sCatalog.GetString(B_TRANSLATE_MARK("Encoded audio")); 218 case B_MEDIA_ENCODED_VIDEO: 219 return sCatalog.GetString(B_TRANSLATE_MARK("Encoded video")); 220 default: { 221 if (type >= B_MEDIA_FIRST_USER_TYPE) { 222 return sCatalog.GetString(B_TRANSLATE_MARK( 223 "User-defined media type")); 224 } 225 if (type >= B_MEDIA_PRIVATE) { 226 return sCatalog.GetString(B_TRANSLATE_MARK( 227 "Private Be media type")); 228 } 229 } 230 } 231 return "Unknown Media Type"; 232 } 233 234 BString MediaString::getStringFor( 235 media_format_family family, 236 bool complete) { 237 D_METHOD(("MediaString::getStringFor(media_format_family)\n")); 238 239 switch (family) { 240 case B_ANY_FORMAT_FAMILY: 241 return sCatalog.GetString(B_TRANSLATE_MARK("Any format family")); 242 case B_BEOS_FORMAT_FAMILY: 243 return sCatalog.GetString(B_TRANSLATE_MARK("BeOS format family")); 244 case B_QUICKTIME_FORMAT_FAMILY: 245 return sCatalog.GetString(B_TRANSLATE_MARK("QuickTime format family")); 246 case B_AVI_FORMAT_FAMILY: 247 return sCatalog.GetString(B_TRANSLATE_MARK("AVI format family")); 248 case B_ASF_FORMAT_FAMILY: 249 return sCatalog.GetString(B_TRANSLATE_MARK("ASF format family")); 250 case B_MPEG_FORMAT_FAMILY: 251 return sCatalog.GetString(B_TRANSLATE_MARK("MPEG format family")); 252 case B_WAV_FORMAT_FAMILY: 253 return sCatalog.GetString(B_TRANSLATE_MARK("WAV format family")); 254 case B_AIFF_FORMAT_FAMILY: 255 return sCatalog.GetString(B_TRANSLATE_MARK("AIFF format family")); 256 default: 257 return sCatalog.GetString(B_TRANSLATE_MARK("Miscellaneous format family")); 258 } 259 } 260 261 BString MediaString::getStringFor( 262 const media_multi_audio_format &format, 263 bool complete) { 264 D_METHOD(("MediaString::getStringFor(media_raw_audio_format)\n")); 265 266 BString s = ""; 267 bool empty = true; 268 269 // sample rate 270 if (format.frame_rate != media_raw_audio_format::wildcard.frame_rate) { 271 s << (empty ? "" : ", ") << forAudioFrameRate(format.frame_rate); 272 empty = false; 273 } 274 275 // format 276 if (format.format != media_raw_audio_format::wildcard.format) { 277 s << (empty ? "" : ", ") << forAudioFormat(format.format, format.valid_bits); 278 empty = false; 279 } 280 281 // channels 282 if (format.channel_count != media_raw_audio_format::wildcard.channel_count) { 283 s << (empty ? "" : ", ") << forAudioChannelCount(format.channel_count); 284 empty = false; 285 } 286 287 if (complete) { 288 // channel mask 289 if (format.channel_mask != media_multi_audio_format::wildcard.channel_mask) { 290 s << (empty ? "" : " ") << "(" << forAudioChannelMask(format.channel_mask) << ")"; 291 empty = false; 292 } 293 294 // matrix mask 295 if (format.matrix_mask != media_multi_audio_format::wildcard.matrix_mask) { 296 s << (empty ? "" : " ") << "(" << forAudioMatrixMask(format.matrix_mask) << ")"; 297 empty = false; 298 } 299 300 // endianess 301 if (format.byte_order != media_raw_audio_format::wildcard.byte_order) { 302 s << (empty ? "" : ", ") << forAudioByteOrder(format.byte_order); 303 empty = false; 304 } 305 306 // buffer size 307 if (format.buffer_size != media_raw_audio_format::wildcard.buffer_size) { 308 s << (empty ? "" : ", ") << forAudioBufferSize(format.buffer_size); 309 empty = false; 310 } 311 } 312 313 return s; 314 } 315 316 BString MediaString::getStringFor( 317 const media_raw_video_format &format, 318 bool complete) { 319 D_METHOD(("MediaString::getStringFor(media_raw_video_format)\n")); 320 321 BString s = ""; 322 bool empty = true; 323 324 // format / color space 325 if (format.display.format != media_video_display_info::wildcard.format) { 326 s << (empty ? "" : ", ") << forVideoFormat(format.display.format); 327 empty = false; 328 } 329 330 // resolution 331 if ((format.display.line_width != media_video_display_info::wildcard.line_width) 332 && (format.display.line_count != media_video_display_info::wildcard.line_count)) { 333 s << (empty ? "" : ", ") << forVideoResolution(format.display.line_width, 334 format.display.line_count); 335 } 336 337 // field rate / interlace 338 if (format.field_rate != media_raw_video_format::wildcard.field_rate) { 339 s << (empty ? "" : ", ") << forVideoFieldRate(format.field_rate, 340 format.interlace); 341 empty = false; 342 } 343 344 if (complete) { 345 346 // aspect ratio 347 if ((format.pixel_width_aspect != media_raw_video_format::wildcard.pixel_width_aspect) 348 && (format.pixel_height_aspect != media_raw_video_format::wildcard.pixel_height_aspect)) { 349 s << (empty ? "" : ", ") << forVideoAspectRatio(format.pixel_width_aspect, 350 format.pixel_height_aspect); 351 empty = false; 352 } 353 354 // orientation 355 if (format.orientation != media_raw_video_format::wildcard.orientation) { 356 s << (empty ? "" : ", ") << forVideoOrientation(format.orientation); 357 empty = false; 358 } 359 360 // active lines 361 if ((format.first_active != media_raw_video_format::wildcard.first_active) 362 && (format.last_active != media_raw_video_format::wildcard.last_active)) { 363 s << (empty ? "" : ", ") << forVideoActiveLines(format.first_active, 364 format.last_active); 365 empty = false; 366 } 367 } 368 return s; 369 } 370 371 BString MediaString::getStringFor( 372 const media_encoded_audio_format &format, 373 bool complete) { 374 D_METHOD(("MediaString::getStringFor(media_encoded_audio_format)\n")); 375 376 BString s = ""; 377 bool empty = true; 378 379 // bit rate 380 if (format.bit_rate != media_encoded_audio_format::wildcard.bit_rate) { 381 s << (empty ? "" : ", ") << forAudioBitRate(format.bit_rate); 382 empty = false; 383 } 384 385 // frame size 386 if (format.frame_size != media_encoded_audio_format::wildcard.frame_size) { 387 s << (empty ? "" : ", ") << forAudioFrameSize(format.frame_size); 388 empty = false; 389 } 390 return s; 391 } 392 393 BString MediaString::getStringFor( 394 const media_encoded_video_format &format, 395 bool complete) { 396 D_METHOD(("MediaString::getStringFor(media_encoded_video_format)\n")); 397 398 BString s = ""; 399 bool empty = true; 400 401 // bit rate 402 if ((format.avg_bit_rate != media_encoded_video_format::wildcard.avg_bit_rate) 403 && (format.max_bit_rate != media_encoded_video_format::wildcard.max_bit_rate)) { 404 s << (empty ? "" : ", ") << forVideoBitRate(format.avg_bit_rate, 405 format.max_bit_rate); 406 empty = false; 407 } 408 409 if (complete) { 410 411 // frame size 412 if (format.frame_size != media_encoded_video_format::wildcard.frame_size) { 413 s << (empty ? "" : ", ") << forVideoFrameSize(format.frame_size); 414 empty = false; 415 } 416 417 // history 418 if ((format.forward_history != media_encoded_video_format::wildcard.forward_history) 419 && (format.backward_history != media_encoded_video_format::wildcard.backward_history)) { 420 s << (empty ? "" : ", ") << forVideoHistory(format.forward_history, 421 format.backward_history); 422 empty = false; 423 } 424 } 425 426 return s; 427 } 428 429 BString MediaString::getStringFor( 430 const media_multistream_format &format, 431 bool complete) { 432 D_METHOD(("MediaString::getStringFor(media_multistream_format)\n")); 433 434 BString s = ""; 435 bool empty = true; 436 437 // format 438 if (format.format != media_multistream_format::wildcard.format) { 439 s << (empty ? "" : ", ") << forMultistreamFormat(format.format); 440 empty = false; 441 } 442 443 // bit rate 444 if ((format.avg_bit_rate != media_multistream_format::wildcard.avg_bit_rate) 445 && (format.max_bit_rate != media_multistream_format::wildcard.max_bit_rate)) { 446 s << (empty ? "" : ", ") << forMultistreamBitRate(format.avg_bit_rate, 447 format.max_bit_rate); 448 empty = false; 449 } 450 451 if (complete) { 452 453 // chunk size 454 if ((format.avg_chunk_size != media_multistream_format::wildcard.avg_chunk_size) 455 && (format.max_chunk_size != media_multistream_format::wildcard.max_chunk_size)) { 456 s << (empty ? "" : ", ") << forMultistreamChunkSize(format.avg_chunk_size, 457 format.max_chunk_size); 458 empty = false; 459 } 460 461 // flags 462 if (format.flags != media_multistream_format::wildcard.flags) { 463 s << (empty ? "" : ", ") << forMultistreamFlags(format.flags); 464 empty = false; 465 } 466 } 467 468 return s; 469 } 470 471 BString MediaString::getStringFor( 472 const media_format &format, 473 bool complete) { 474 D_METHOD(("MediaString::getStringFor(media_format)\n")); 475 476 BString s = getStringFor(format.type, complete); 477 switch (format.type) { 478 case B_MEDIA_RAW_AUDIO: { 479 BString formatInfo = getStringFor(format.u.raw_audio, complete); 480 if (formatInfo.Length() > 0) 481 s << " (" << formatInfo << ")"; 482 break; 483 } 484 case B_MEDIA_RAW_VIDEO: { 485 BString formatInfo = getStringFor(format.u.raw_video, complete); 486 if (formatInfo.Length() > 0) 487 s << " (" << formatInfo << ")"; 488 break; 489 } 490 case B_MEDIA_ENCODED_AUDIO: { 491 BString formatInfo = getStringFor(format.u.encoded_audio, complete); 492 if (formatInfo.Length() > 0) 493 s << " (" << formatInfo << ")"; 494 break; 495 } 496 case B_MEDIA_ENCODED_VIDEO: { 497 BString formatInfo = getStringFor(format.u.encoded_video, complete); 498 if (formatInfo.Length() > 0) 499 s << " (" << formatInfo << ")"; 500 break; 501 } 502 case B_MEDIA_MULTISTREAM: { 503 BString formatInfo = getStringFor(format.u.multistream, complete); 504 if (formatInfo.Length() > 0) 505 s << " (" << formatInfo << ")"; 506 break; 507 } 508 default: { 509 break; 510 } 511 } 512 return s; 513 } 514 515 // -------------------------------------------------------- // 516 // *** media_source / media_destination strings (public) 517 // -------------------------------------------------------- // 518 519 BString MediaString::getStringFor( 520 const media_source &source, 521 bool complete) { 522 D_METHOD(("MediaString::getStringFor(media_source)\n")); 523 524 BString s; 525 if ((source.port != media_source::null.port) 526 && (source.id != media_source::null.id)) { 527 s << sCatalog.GetString(B_TRANSLATE_MARK("Port ")) << source.port 528 << sCatalog.GetString(B_TRANSLATE_MARK(", ID ")) << source.id; 529 } 530 else { 531 s = sCatalog.GetString(B_TRANSLATE_MARK("(none)")); 532 } 533 return s; 534 } 535 536 BString MediaString::getStringFor( 537 const media_destination &destination, 538 bool complete) { 539 D_METHOD(("MediaString::getStringFor(media_destination)\n")); 540 541 BString s; 542 if ((destination.port != media_destination::null.port) 543 && (destination.id != media_destination::null.id)) { 544 s << sCatalog.GetString(B_TRANSLATE_MARK("Port ")) << destination.port 545 << sCatalog.GetString(B_TRANSLATE_MARK(", ID ")) << destination.id; 546 } 547 else { 548 s = sCatalog.GetString(B_TRANSLATE_MARK("(none)")); 549 } 550 return s; 551 } 552 553 // -------------------------------------------------------- // 554 // *** strings for single fields in media_raw_audio_format 555 // (public) 556 // -------------------------------------------------------- // 557 558 BString MediaString::forAudioFormat( 559 uint32 format, 560 int32 validBits) { 561 D_METHOD(("MediaString::forAudioFormat()\n")); 562 563 if (format == media_raw_audio_format::wildcard.format) { 564 return "*"; 565 } 566 567 switch (format) { 568 case media_raw_audio_format::B_AUDIO_UCHAR: { 569 return sCatalog.GetString(B_TRANSLATE_MARK("8 bit integer")); 570 } 571 case media_raw_audio_format::B_AUDIO_SHORT: { 572 return sCatalog.GetString(B_TRANSLATE_MARK("16 bit integer")); 573 } 574 case media_raw_audio_format::B_AUDIO_FLOAT: { 575 return sCatalog.GetString(B_TRANSLATE_MARK("32 bit float")); 576 } 577 case media_raw_audio_format::B_AUDIO_INT: { 578 BString s = ""; 579 if (validBits != media_multi_audio_format::wildcard.valid_bits) 580 s << validBits << sCatalog.GetString(B_TRANSLATE_MARK(" bit ")); 581 else 582 s << sCatalog.GetString(B_TRANSLATE_MARK("32 bit ")); 583 s << sCatalog.GetString(B_TRANSLATE_MARK("integer")); 584 return s; 585 } 586 default: { 587 return sCatalog.GetString(B_TRANSLATE_MARK("(unknown format)")); 588 } 589 } 590 } 591 592 BString MediaString::forAudioFrameRate( 593 float frameRate) 594 { 595 D_METHOD(("MediaString::forAudioFrameRate()\n")); 596 597 if (frameRate == media_raw_audio_format::wildcard.frame_rate) { 598 return "*"; 599 } 600 601 BString s; 602 s << (frameRate / 1000) << sCatalog.GetString(B_TRANSLATE_MARK(" kHz")); 603 return s; 604 } 605 606 BString MediaString::forAudioChannelCount( 607 uint32 channelCount) 608 { 609 D_METHOD(("MediaString::forAudioChannelCount()\n")); 610 611 if (channelCount == media_raw_audio_format::wildcard.channel_count) { 612 return "*"; 613 } 614 615 switch (channelCount) { 616 case 1: { 617 return sCatalog.GetString(B_TRANSLATE_MARK("Mono")); 618 } 619 case 2: { 620 return sCatalog.GetString(B_TRANSLATE_MARK("Stereo")); 621 } 622 default: { 623 BString s = ""; 624 s << channelCount 625 << sCatalog.GetString(B_TRANSLATE_MARK(" Channels")); 626 return s; 627 } 628 } 629 } 630 631 BString MediaString::forAudioByteOrder( 632 uint32 byteOrder) 633 { 634 D_METHOD(("MediaString::forAudioByteOrder()\n")); 635 636 if (byteOrder == media_raw_audio_format::wildcard.byte_order) { 637 return "*"; 638 } 639 640 switch (byteOrder) { 641 case B_MEDIA_BIG_ENDIAN: { 642 return sCatalog.GetString(B_TRANSLATE_MARK("Big endian")); 643 } 644 case B_MEDIA_LITTLE_ENDIAN: { 645 return sCatalog.GetString(B_TRANSLATE_MARK("Little endian")); 646 } 647 default: { 648 return sCatalog.GetString(B_TRANSLATE_MARK("(unknown byte order)")); 649 } 650 } 651 } 652 653 BString MediaString::forAudioBufferSize( 654 size_t bufferSize) 655 { 656 D_METHOD(("MediaString::forAudioBufferSize()\n")); 657 658 if (bufferSize == media_raw_audio_format::wildcard.buffer_size) { 659 return "*"; 660 } 661 662 BString s = ""; 663 s << bufferSize << sCatalog.GetString(B_TRANSLATE_MARK(" bytes per buffer")); 664 return s; 665 } 666 667 BString MediaString::forAudioChannelMask( 668 uint32 channelMask) { 669 D_METHOD(("MediaString::forAudioChannelMask()\n")); 670 671 BString list, last; 672 bool first = true; 673 674 if (channelMask & B_CHANNEL_LEFT) { 675 if (first) { 676 list = sCatalog.GetString(B_TRANSLATE_MARK("Left")); 677 first = false; 678 } 679 } 680 if (channelMask & B_CHANNEL_RIGHT) { 681 if (first) { 682 list = sCatalog.GetString(B_TRANSLATE_MARK("Right")); 683 first = false; 684 } 685 else { 686 if (last != "") 687 list << ", " << last; 688 last = sCatalog.GetString(B_TRANSLATE_MARK("Right")); 689 } 690 } 691 if (channelMask & B_CHANNEL_CENTER) { 692 if (first) { 693 list = sCatalog.GetString(B_TRANSLATE_MARK("Center")); 694 first = false; 695 } 696 else { 697 if (last != "") 698 list << ", " << last; 699 last = sCatalog.GetString(B_TRANSLATE_MARK("Center")); 700 } 701 } 702 if (channelMask & B_CHANNEL_SUB) { 703 if (first) { 704 list = sCatalog.GetString(B_TRANSLATE_MARK("Sub")); 705 first = false; 706 } 707 else { 708 if (last != "") 709 list << ", " << last; 710 last = sCatalog.GetString(B_TRANSLATE_MARK("Sub")); 711 } 712 } 713 if (channelMask & B_CHANNEL_REARLEFT) { 714 if (first) { 715 list = sCatalog.GetString(B_TRANSLATE_MARK("Rear-left")); 716 first = false; 717 } 718 else { 719 if (last != "") 720 list << ", " << last; 721 last = sCatalog.GetString(B_TRANSLATE_MARK("Rear-left")); 722 } 723 } 724 if (channelMask & B_CHANNEL_REARRIGHT) { 725 if (first) { 726 list = sCatalog.GetString(B_TRANSLATE_MARK("Rear-right")); 727 first = false; 728 } 729 else { 730 if (last != "") 731 list << ", " << last; 732 last = sCatalog.GetString(B_TRANSLATE_MARK("Rear-right")); 733 } 734 } 735 if (channelMask & B_CHANNEL_FRONT_LEFT_CENTER) { 736 if (first) { 737 list = sCatalog.GetString(B_TRANSLATE_MARK("Front-left-center")); 738 first = false; 739 } 740 else { 741 if (last != "") 742 list << ", " << last; 743 last = sCatalog.GetString(B_TRANSLATE_MARK("Front-left-center")); 744 } 745 } 746 if (channelMask & B_CHANNEL_FRONT_RIGHT_CENTER) { 747 if (first) { 748 list = sCatalog.GetString(B_TRANSLATE_MARK("Front-right-center")); 749 first = false; 750 } 751 else { 752 if (last != "") 753 list << ", " << last; 754 last = sCatalog.GetString(B_TRANSLATE_MARK("Front-right-center")); 755 } 756 } 757 if (channelMask & B_CHANNEL_BACK_CENTER) { 758 if (first) { 759 list = sCatalog.GetString(B_TRANSLATE_MARK("Back-center")); 760 first = false; 761 } 762 else { 763 if (last != "") 764 list << ", " << last; 765 last = sCatalog.GetString(B_TRANSLATE_MARK("Back-center")); 766 } 767 } 768 if (channelMask & B_CHANNEL_SIDE_LEFT) { 769 if (first) { 770 list = sCatalog.GetString(B_TRANSLATE_MARK("Side-left")); 771 first = false; 772 } 773 else { 774 if (last != "") 775 list << ", " << last; 776 last = sCatalog.GetString(B_TRANSLATE_MARK("Side-left")); 777 } 778 } 779 if (channelMask & B_CHANNEL_SIDE_RIGHT) { 780 if (first) { 781 list = sCatalog.GetString(B_TRANSLATE_MARK("Side-right")); 782 first = false; 783 } 784 else { 785 if (last != "") 786 list << ", " << last; 787 last = sCatalog.GetString(B_TRANSLATE_MARK("Side-right")); 788 } 789 } 790 if (channelMask & B_CHANNEL_TOP_CENTER) { 791 if (first) { 792 list = sCatalog.GetString(B_TRANSLATE_MARK("Top-center")); 793 first = false; 794 } 795 else { 796 if (last != "") 797 list << ", " << last; 798 last = sCatalog.GetString(B_TRANSLATE_MARK("Top-center")); 799 } 800 } 801 if (channelMask & B_CHANNEL_TOP_FRONT_LEFT) { 802 if (first) { 803 list = sCatalog.GetString(B_TRANSLATE_MARK("Top-Front-left")); 804 first = false; 805 } 806 else { 807 if (last != "") 808 list << ", " << last; 809 last = sCatalog.GetString(B_TRANSLATE_MARK("Top-Front-left")); 810 } 811 } 812 if (channelMask & B_CHANNEL_TOP_FRONT_CENTER) { 813 if (first) { 814 list = sCatalog.GetString(B_TRANSLATE_MARK("Top-Front-center")); 815 first = false; 816 } 817 else { 818 if (last != "") 819 list << ", " << last; 820 last = sCatalog.GetString(B_TRANSLATE_MARK("Top-Front-center")); 821 } 822 } 823 if (channelMask & B_CHANNEL_TOP_FRONT_RIGHT) { 824 if (first) { 825 list = sCatalog.GetString(B_TRANSLATE_MARK("Top-Front-right")); 826 first = false; 827 } 828 else { 829 if (last != "") 830 list << ", " << last; 831 last = sCatalog.GetString(B_TRANSLATE_MARK("Top-Front-right")); 832 } 833 } 834 if (channelMask & B_CHANNEL_TOP_BACK_LEFT) { 835 if (first) { 836 list = sCatalog.GetString(B_TRANSLATE_MARK("Top-Back-left")); 837 first = false; 838 } 839 else { 840 if (last != "") 841 list << ", " << last; 842 last = sCatalog.GetString(B_TRANSLATE_MARK("Top-Back-left")); 843 } 844 } 845 if (channelMask & B_CHANNEL_TOP_BACK_CENTER) { 846 if (first) { 847 list = sCatalog.GetString(B_TRANSLATE_MARK("Top-Back-center")); 848 first = false; 849 } 850 else { 851 if (last != "") 852 list << ", " << last; 853 last = sCatalog.GetString(B_TRANSLATE_MARK("Top-Back-center")); 854 } 855 } 856 if (channelMask & B_CHANNEL_TOP_BACK_RIGHT) { 857 if (first) { 858 list = sCatalog.GetString(B_TRANSLATE_MARK("Top-Back-right")); 859 first = false; 860 } 861 else { 862 if (last != "") 863 list << ", " << last; 864 last = sCatalog.GetString(B_TRANSLATE_MARK("Top-Back-right")); 865 } 866 } 867 if (last != "") { 868 list << " & " << last; 869 } 870 if (list == "") { 871 list = sCatalog.GetString(B_TRANSLATE_MARK("(none)")); 872 } 873 874 return list; 875 } 876 877 BString MediaString::forAudioMatrixMask( 878 uint16 matrixMask) { 879 D_METHOD(("MediaString::forAudioMatrixMask()\n")); 880 881 switch (matrixMask) { 882 case 0: 883 return sCatalog.GetString(B_TRANSLATE_MARK("(none)")); 884 case B_MATRIX_PROLOGIC_LR: 885 return sCatalog.GetString(B_TRANSLATE_MARK("ProLogic LR")); 886 case B_MATRIX_AMBISONIC_WXYZ: 887 return sCatalog.GetString(B_TRANSLATE_MARK("Ambisonic WXYZ")); 888 default: 889 return sCatalog.GetString(B_TRANSLATE_MARK("(unknown matrix mask)")); 890 } 891 } 892 893 // -------------------------------------------------------- // 894 // *** strings for single fields in media_encoded_audio_format 895 // (public) 896 // -------------------------------------------------------- // 897 898 BString MediaString::forAudioBitRate( 899 float bitRate) 900 { 901 D_METHOD(("MediaString::forAudioBufferSize()\n")); 902 903 if (bitRate == media_encoded_audio_format::wildcard.bit_rate) { 904 return "*"; 905 } 906 907 BString s = ""; 908 s << bitRate / 1000.0f << sCatalog.GetString(B_TRANSLATE_MARK(" kb/s")); 909 return s; 910 } 911 912 BString MediaString::forAudioFrameSize( 913 size_t frameSize) 914 { 915 D_METHOD(("MediaString::forAudioFrameSize()\n")); 916 917 if (frameSize == media_encoded_audio_format::wildcard.frame_size) { 918 return "*"; 919 } 920 921 BString s = ""; 922 s << frameSize << sCatalog.GetString(B_TRANSLATE_MARK(" bytes per frame")); 923 return s; 924 } 925 926 // -------------------------------------------------------- // 927 // *** strings for single fields in media_raw_video_format 928 // (public) 929 // -------------------------------------------------------- // 930 931 BString MediaString::forVideoFormat( 932 color_space format) 933 { 934 D_METHOD(("MediaString::forVideoFormat()\n")); 935 936 if (format == media_video_display_info::wildcard.format) { 937 return "*"; 938 } 939 940 switch (format) { 941 case B_RGB32: 942 case B_RGB32_BIG: 943 return sCatalog.GetString(B_TRANSLATE_MARK("32 bit RGB")); 944 case B_RGBA32: 945 case B_RGBA32_BIG: 946 return sCatalog.GetString(B_TRANSLATE_MARK("32 bit RGBA")); 947 case B_RGB24: 948 case B_RGB24_BIG: 949 return sCatalog.GetString(B_TRANSLATE_MARK("24 bit RGB")); 950 case B_RGB16: 951 case B_RGB16_BIG: 952 return sCatalog.GetString(B_TRANSLATE_MARK("16 bit RGB")); 953 case B_RGB15: 954 case B_RGB15_BIG: 955 return sCatalog.GetString(B_TRANSLATE_MARK("15 bit RGB")); 956 case B_RGBA15: 957 case B_RGBA15_BIG: 958 return sCatalog.GetString(B_TRANSLATE_MARK("15 bit RGBA")); 959 case B_CMAP8: 960 return sCatalog.GetString(B_TRANSLATE_MARK("8 bit color-index")); 961 case B_GRAY8: 962 return sCatalog.GetString(B_TRANSLATE_MARK("8 bit grayscale-index")); 963 case B_GRAY1: 964 return sCatalog.GetString(B_TRANSLATE_MARK("Monochrome")); 965 case B_YUV422: 966 return sCatalog.GetString(B_TRANSLATE_MARK("YUV422")); 967 case B_YUV411: 968 return sCatalog.GetString(B_TRANSLATE_MARK("YUV411")); 969 case B_YUV420: 970 return sCatalog.GetString(B_TRANSLATE_MARK("YUV420")); 971 case B_YUV444: 972 return sCatalog.GetString(B_TRANSLATE_MARK("YUV444")); 973 case B_YUV9: 974 return sCatalog.GetString(B_TRANSLATE_MARK("YUV9")); 975 case B_YUV12: 976 return sCatalog.GetString(B_TRANSLATE_MARK("YUV12")); 977 case B_YCbCr422: 978 return sCatalog.GetString(B_TRANSLATE_MARK("YCbCr422")); 979 case B_YCbCr411: 980 return sCatalog.GetString(B_TRANSLATE_MARK("YCbCr411")); 981 case B_YCbCr444: 982 return sCatalog.GetString(B_TRANSLATE_MARK("YCbCr444")); 983 case B_YCbCr420: 984 return sCatalog.GetString(B_TRANSLATE_MARK("YCbCr420")); 985 case B_UVL24: 986 return sCatalog.GetString(B_TRANSLATE_MARK("24 bit UVL")); 987 case B_UVL32: 988 return sCatalog.GetString(B_TRANSLATE_MARK("32 bit UVL")); 989 case B_UVLA32: 990 return sCatalog.GetString(B_TRANSLATE_MARK("32 bit UVLA")); 991 case B_LAB24: 992 return sCatalog.GetString(B_TRANSLATE_MARK("24 bit LAB")); 993 case B_LAB32: 994 return sCatalog.GetString(B_TRANSLATE_MARK("32 bit LAB")); 995 case B_LABA32: 996 return sCatalog.GetString(B_TRANSLATE_MARK("32 bit LABA")); 997 case B_HSI24: 998 return sCatalog.GetString(B_TRANSLATE_MARK("24 bit HSI")); 999 case B_HSI32: 1000 return sCatalog.GetString(B_TRANSLATE_MARK("32 bit HSI")); 1001 case B_HSIA32: 1002 return sCatalog.GetString(B_TRANSLATE_MARK("32 bit HSIA")); 1003 case B_HSV24: 1004 return sCatalog.GetString(B_TRANSLATE_MARK("24 bit HSV")); 1005 case B_HSV32: 1006 return sCatalog.GetString(B_TRANSLATE_MARK("32 bit HSV")); 1007 case B_HSVA32: 1008 return sCatalog.GetString(B_TRANSLATE_MARK("32 bit HSVA")); 1009 case B_HLS24: 1010 return sCatalog.GetString(B_TRANSLATE_MARK("24 bit HLS")); 1011 case B_HLS32: 1012 return sCatalog.GetString(B_TRANSLATE_MARK("32 bit HLS")); 1013 case B_HLSA32: 1014 return sCatalog.GetString(B_TRANSLATE_MARK("32 bit HLSA")); 1015 case B_CMY24: 1016 return sCatalog.GetString(B_TRANSLATE_MARK("24 bit CMY")); 1017 case B_CMY32: 1018 return sCatalog.GetString(B_TRANSLATE_MARK("32 bit CMY")); 1019 case B_CMYA32: 1020 return sCatalog.GetString(B_TRANSLATE_MARK("32 bit CMYA")); 1021 case B_CMYK32: 1022 return sCatalog.GetString(B_TRANSLATE_MARK("32 bit CMYK")); 1023 default: { 1024 return sCatalog.GetString(B_TRANSLATE_MARK("(unknown video format)")); 1025 } 1026 } 1027 } 1028 1029 BString MediaString::forVideoResolution( 1030 uint32 lineWidth, 1031 uint32 lineCount) 1032 { 1033 D_METHOD(("MediaString::forVideoResolution()\n")); 1034 1035 if ((lineWidth == media_video_display_info::wildcard.line_width) 1036 || (lineCount == media_video_display_info::wildcard.line_count)) { 1037 return "*"; 1038 } 1039 1040 BString s = ""; 1041 s << lineWidth << " x " << lineCount; 1042 return s; 1043 } 1044 1045 BString MediaString::forVideoFieldRate( 1046 float fieldRate, 1047 uint32 interlace) 1048 { 1049 D_METHOD(("MediaString::forVideoFieldRate()\n")); 1050 1051 if (fieldRate == media_raw_video_format::wildcard.field_rate) { 1052 return "*"; 1053 } 1054 1055 BString s = ""; 1056 if (interlace == 1) { 1057 s << sCatalog.GetString(B_TRANSLATE_MARK("Non-interlaced ")); 1058 } 1059 else { 1060 s << sCatalog.GetString(B_TRANSLATE_MARK("Interlaced ")); 1061 } 1062 s << fieldRate << sCatalog.GetString(B_TRANSLATE_MARK(" Hz")); 1063 if ((fieldRate > 49.9) && (fieldRate < 50.1)) { 1064 s << sCatalog.GetString(B_TRANSLATE_MARK(" (PAL)")); 1065 } 1066 else if (((interlace == 2) && (fieldRate > 59.9) && (fieldRate < 60.0)) 1067 || ((interlace == 1) && (fieldRate > 29.9) && (fieldRate < 30.0))) { 1068 s << sCatalog.GetString(B_TRANSLATE_MARK(" (NTSC)")); 1069 } 1070 1071 return s; 1072 } 1073 1074 BString MediaString::forVideoOrientation( 1075 uint32 orientation) 1076 { 1077 D_METHOD(("MediaString::forVideoOrientation()\n")); 1078 1079 if (orientation == media_raw_video_format::wildcard.orientation) { 1080 return "*"; 1081 } 1082 1083 switch (orientation) { 1084 case B_VIDEO_TOP_LEFT_RIGHT: { 1085 return sCatalog.GetString(B_TRANSLATE_MARK( 1086 "Top to bottom, left to right")); 1087 } 1088 case B_VIDEO_BOTTOM_LEFT_RIGHT: { 1089 return sCatalog.GetString(B_TRANSLATE_MARK( 1090 "Bottom to top, left to right")); 1091 } 1092 default: { 1093 return sCatalog.GetString(B_TRANSLATE_MARK( 1094 "(unkown video orientation)")); 1095 } 1096 } 1097 } 1098 1099 BString MediaString::forVideoAspectRatio( 1100 uint16 pixelWidth, 1101 uint16 pixelHeight) 1102 { 1103 D_METHOD(("MediaString::forVideoPixelAspect()\n")); 1104 1105 if ((pixelWidth == media_raw_video_format::wildcard.pixel_width_aspect) 1106 || (pixelHeight == media_raw_video_format::wildcard.pixel_height_aspect)) { 1107 return "*"; 1108 } 1109 1110 BString s = ""; 1111 s << static_cast<uint32>(pixelWidth); 1112 s << ":" << static_cast<uint32>(pixelHeight); 1113 return s; 1114 } 1115 1116 BString MediaString::forVideoActiveLines( 1117 uint32 firstActive, 1118 uint32 lastActive) 1119 { 1120 D_METHOD(("MediaString::forVideoActiveLines()\n")); 1121 1122 if ((firstActive == media_raw_video_format::wildcard.first_active) 1123 || (lastActive == media_raw_video_format::wildcard.last_active)) { 1124 return "*"; 1125 } 1126 1127 BString s = sCatalog.GetString(B_TRANSLATE_MARK("Video data between")); 1128 s << sCatalog.GetString(B_TRANSLATE_MARK(" line ")) << firstActive; 1129 s << sCatalog.GetString(B_TRANSLATE_MARK(" and ")) << lastActive; 1130 return s; 1131 } 1132 1133 BString MediaString::forVideoBytesPerRow( 1134 uint32 bytesPerRow) 1135 { 1136 D_METHOD(("MediaString::forVideoBytesPerRow()\n")); 1137 1138 if (bytesPerRow == media_video_display_info::wildcard.bytes_per_row) { 1139 return "*"; 1140 } 1141 1142 BString s = ""; 1143 s << bytesPerRow << sCatalog.GetString(B_TRANSLATE_MARK(" bytes per row")); 1144 return s; 1145 } 1146 1147 BString MediaString::forVideoOffset( 1148 uint32 pixelOffset, 1149 uint32 lineOffset) 1150 { 1151 D_METHOD(("MediaString::forVideoResolution()\n")); 1152 1153 BString s = ""; 1154 if (pixelOffset != media_video_display_info::wildcard.pixel_offset) { 1155 s << pixelOffset << sCatalog.GetString(B_TRANSLATE_MARK(" pixels")); 1156 } 1157 if (lineOffset != media_video_display_info::wildcard.line_offset) { 1158 if (s != "") { 1159 s << ", "; 1160 } 1161 s << pixelOffset << sCatalog.GetString(B_TRANSLATE_MARK(" lines")); 1162 } 1163 if (s == "") { 1164 s = "*"; 1165 } 1166 return s; 1167 } 1168 1169 // -------------------------------------------------------- // 1170 // *** strings for single fields in media_encoded_video_format 1171 // (public) 1172 // -------------------------------------------------------- // 1173 1174 BString MediaString::forVideoBitRate( 1175 float avgBitRate, 1176 float maxBitRate) 1177 { 1178 D_METHOD(("MediaString::forVideoBitRate()\n")); 1179 1180 BString s = ""; 1181 if (avgBitRate != media_encoded_video_format::wildcard.avg_bit_rate) { 1182 s << avgBitRate / 1000.0f << sCatalog.GetString(B_TRANSLATE_MARK(" kb/s (avg)")); 1183 } 1184 if (maxBitRate != media_encoded_video_format::wildcard.max_bit_rate) { 1185 if (s != "") { 1186 s << ", "; 1187 } 1188 s << maxBitRate / 1000.0f << sCatalog.GetString(B_TRANSLATE_MARK(" kb/s (max)")); 1189 } 1190 if (s == "") { 1191 s = "*"; 1192 } 1193 return s; 1194 } 1195 1196 BString MediaString::forVideoFrameSize( 1197 size_t frameSize) 1198 { 1199 D_METHOD(("MediaString::forVideoFrameSize()\n")); 1200 1201 if (frameSize == media_encoded_video_format::wildcard.frame_size) { 1202 return "*"; 1203 } 1204 1205 BString s = ""; 1206 s << frameSize << sCatalog.GetString(B_TRANSLATE_MARK(" bytes per frame")); 1207 return s; 1208 } 1209 1210 BString MediaString::forVideoHistory( 1211 int16 forwardHistory, 1212 int16 backwardHistory) 1213 { 1214 D_METHOD(("MediaString::forVideoHistory()\n")); 1215 1216 BString s = ""; 1217 if (forwardHistory != media_encoded_video_format::wildcard.forward_history) { 1218 s << static_cast<int32>(forwardHistory) 1219 << sCatalog.GetString(B_TRANSLATE_MARK(" frames forward")); 1220 } 1221 if (backwardHistory != media_encoded_video_format::wildcard.backward_history) { 1222 if (s != "") { 1223 s << ", "; 1224 } 1225 s << static_cast<int32>(backwardHistory) 1226 << sCatalog.GetString(B_TRANSLATE_MARK(" frames backward")); 1227 } 1228 if (s == "") { 1229 s = "*"; 1230 } 1231 return s; 1232 } 1233 1234 // -------------------------------------------------------- // 1235 // *** strings for single fields in media_multistream_format 1236 // (public) 1237 // -------------------------------------------------------- // 1238 1239 BString MediaString::forMultistreamFormat( 1240 int32 format) 1241 { 1242 D_METHOD(("MediaString::forMultistreamFormat()\n")); 1243 1244 if (format == media_multistream_format::wildcard.format) { 1245 return "*"; 1246 } 1247 1248 switch (format) { 1249 case media_multistream_format::B_VID: 1250 return sCatalog.GetString(B_TRANSLATE_MARK("BeOS video")); 1251 case media_multistream_format::B_AVI: 1252 return sCatalog.GetString(B_TRANSLATE_MARK("AVI")); 1253 case media_multistream_format::B_MPEG1: 1254 return sCatalog.GetString(B_TRANSLATE_MARK("MPEG1")); 1255 case media_multistream_format::B_MPEG2: 1256 return sCatalog.GetString(B_TRANSLATE_MARK("MPEG2")); 1257 case media_multistream_format::B_QUICKTIME: 1258 return sCatalog.GetString(B_TRANSLATE_MARK("QuickTime")); 1259 default: 1260 return sCatalog.GetString(B_TRANSLATE_MARK("(unknown multistream format)")); 1261 } 1262 } 1263 1264 BString MediaString::forMultistreamBitRate( 1265 float avgBitRate, 1266 float maxBitRate) 1267 { 1268 D_METHOD(("MediaString::forMultistreamFormat()\n")); 1269 1270 BString s = ""; 1271 if (avgBitRate != media_multistream_format::wildcard.avg_bit_rate) { 1272 s << avgBitRate / 1000.0f << sCatalog.GetString(B_TRANSLATE_MARK(" kb/s (avg)")); 1273 } 1274 if (maxBitRate != media_multistream_format::wildcard.max_bit_rate) { 1275 if (s != "") { 1276 s << ", "; 1277 } 1278 s << maxBitRate / 1000.0f << sCatalog.GetString(B_TRANSLATE_MARK(" kb/s (max)")); 1279 } 1280 if (s == "") { 1281 s = "*"; 1282 } 1283 return s; 1284 } 1285 1286 BString MediaString::forMultistreamChunkSize( 1287 uint32 avgChunkSize, 1288 uint32 maxChunkSize) 1289 { 1290 D_METHOD(("MediaString::forMultistreamChunkSize()\n")); 1291 1292 BString s = ""; 1293 if (avgChunkSize != media_multistream_format::wildcard.avg_chunk_size) { 1294 s << avgChunkSize << sCatalog.GetString(B_TRANSLATE_MARK(" bytes (avg)")); 1295 } 1296 if (maxChunkSize != media_multistream_format::wildcard.max_chunk_size) { 1297 if (s != "") { 1298 s << ", "; 1299 } 1300 s << maxChunkSize << sCatalog.GetString(B_TRANSLATE_MARK(" bytes (max)")); 1301 } 1302 if (s == "") { 1303 s = "*"; 1304 } 1305 return s; 1306 } 1307 1308 BString MediaString::forMultistreamFlags( 1309 uint32 flags) 1310 { 1311 D_METHOD(("MediaString::forMultistreamFlags()\n")); 1312 1313 BString list, last; 1314 bool first = true; 1315 1316 if (flags & media_multistream_format::B_HEADER_HAS_FLAGS) { 1317 if (first) { 1318 list = sCatalog.GetString(B_TRANSLATE_MARK("Header has flags")); 1319 first = false; 1320 } 1321 } 1322 if (flags & media_multistream_format::B_CLEAN_BUFFERS) { 1323 if (first) { 1324 list = sCatalog.GetString(B_TRANSLATE_MARK("Clean buffers")); 1325 first = false; 1326 } 1327 else { 1328 if (last != "") 1329 list << ", " << last; 1330 last = sCatalog.GetString(B_TRANSLATE_MARK("Clean buffers")); 1331 } 1332 } 1333 if (flags & media_multistream_format::B_HOMOGENOUS_BUFFERS) { 1334 if (first) { 1335 list = sCatalog.GetString(B_TRANSLATE_MARK("Homogenous buffers")); 1336 first = false; 1337 } 1338 else { 1339 if (last != "") 1340 list << ", " << last; 1341 last = sCatalog.GetString(B_TRANSLATE_MARK("Homogenous buffers")); 1342 } 1343 } 1344 1345 if (last != "") 1346 list << " & " << last; 1347 1348 if (list == "") 1349 list = sCatalog.GetString(B_TRANSLATE_MARK("(none)")); 1350 1351 return list; 1352 } 1353 1354 // END -- MediaString.cpp -- 1355