2 * Copyright (c) 1999-2000, Eric Moon.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions, and the following disclaimer.
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.
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.
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.
34 #include "MediaString.h"
37 #include <MediaFormats.h>
41 __USE_CORTEX_NAMESPACE
44 #define D_METHOD(x) //PRINT (x)
46 // -------------------------------------------------------- //
47 // *** media_node strings (public)
48 // -------------------------------------------------------- //
50 BString
MediaString::getStringFor(
53 D_METHOD(("MediaString::getStringFor(node_kind)\n"));
58 if (kinds
& B_BUFFER_PRODUCER
) {
60 list
= "Buffer producer";
64 if (kinds
& B_BUFFER_CONSUMER
) {
66 list
= "Buffer consumer";
72 last
= "Buffer consumer";
75 if (kinds
& B_TIME_SOURCE
) {
86 if (kinds
& B_CONTROLLABLE
) {
88 list
= "Controllable";
94 last
= "Controllable";
97 if (kinds
& B_FILE_INTERFACE
) {
99 list
= "File interface";
104 list
<< ", " << last
;
105 last
= "File interface";
108 if (kinds
& B_ENTITY_INTERFACE
) {
110 list
= "Entity interface";
115 list
<< ", " << last
;
116 last
= "Entity interface";
119 if (kinds
& B_PHYSICAL_INPUT
) {
121 list
= "Physical input";
126 list
<< ", " << last
;
127 last
= "Physical input";
130 if (kinds
& B_PHYSICAL_OUTPUT
) {
132 list
= "Physical output";
137 list
<< ", " << last
;
138 last
= "Physical output";
141 if (kinds
& B_SYSTEM_MIXER
) {
143 list
= "System mixer";
148 list
<< ", " << last
;
149 last
= "System mixer";
154 list
<< " & " << last
;
158 BString
MediaString::getStringFor(
159 BMediaNode::run_mode runMode
,
162 D_METHOD(("MediaString::getStringFor(run_mode)\n"));
165 case BMediaNode::B_OFFLINE
: return "Offline";
166 case BMediaNode::B_RECORDING
: return "Recording";
167 case BMediaNode::B_DECREASE_PRECISION
: return "Decrease precision";
168 case BMediaNode::B_INCREASE_LATENCY
: return "Increase latency";
169 case BMediaNode::B_DROP_DATA
: return "Drop data";
170 default: return "(unknown run mode)";
174 // -------------------------------------------------------- //
175 // *** media_format strings (public)
176 // -------------------------------------------------------- //
178 BString
MediaString::getStringFor(
181 D_METHOD(("MediaString::getStringFor(media_type)\n"));
184 case B_MEDIA_NO_TYPE
: return "Typeless media";
185 case B_MEDIA_UNKNOWN_TYPE
: return "Unknown media type";
186 case B_MEDIA_RAW_AUDIO
: return "Raw audio";
187 case B_MEDIA_RAW_VIDEO
: return "Raw video";
188 case B_MEDIA_VBL
: return "Raw data from VBL area";
189 case B_MEDIA_TIMECODE
: return "Timecode";
190 case B_MEDIA_MIDI
: return "MIDI";
191 case B_MEDIA_TEXT
: return "Text";
192 case B_MEDIA_HTML
: return "HTML";
193 case B_MEDIA_MULTISTREAM
: return "Multistream media";
194 case B_MEDIA_PARAMETERS
: return "Parameters";
195 case B_MEDIA_ENCODED_AUDIO
: return "Encoded audio";
196 case B_MEDIA_ENCODED_VIDEO
: return "Encoded video";
198 if (type
>= B_MEDIA_FIRST_USER_TYPE
)
199 return "User-defined media type";
200 if (type
>= B_MEDIA_PRIVATE
)
201 return "Private Be media type";
204 return "Unknown Media Type";
207 BString
MediaString::getStringFor(
208 media_format_family family
,
210 D_METHOD(("MediaString::getStringFor(media_format_family)\n"));
213 case B_ANY_FORMAT_FAMILY
: return "Any format family";
214 case B_BEOS_FORMAT_FAMILY
: return "BeOS format family";
215 case B_QUICKTIME_FORMAT_FAMILY
: return "QuickTime format family";
216 case B_AVI_FORMAT_FAMILY
: return "AVI format family";
217 case B_ASF_FORMAT_FAMILY
: return "ASF format family";
218 case B_MPEG_FORMAT_FAMILY
: return "MPEG format family";
219 case B_WAV_FORMAT_FAMILY
: return "WAV format family";
220 case B_AIFF_FORMAT_FAMILY
: return "AIFF format family";
221 default: return "Miscellaneous format family";
225 BString
MediaString::getStringFor(
226 const media_multi_audio_format
&format
,
228 D_METHOD(("MediaString::getStringFor(media_raw_audio_format)\n"));
234 if (format
.frame_rate
!= media_raw_audio_format::wildcard
.frame_rate
) {
235 s
<< (empty
? "" : ", ") << forAudioFrameRate(format
.frame_rate
);
240 if (format
.format
!= media_raw_audio_format::wildcard
.format
) {
241 s
<< (empty
? "" : ", ") << forAudioFormat(format
.format
, format
.valid_bits
);
246 if (format
.channel_count
!= media_raw_audio_format::wildcard
.channel_count
) {
247 s
<< (empty
? "" : ", ") << forAudioChannelCount(format
.channel_count
);
253 if (format
.channel_mask
!= media_multi_audio_format::wildcard
.channel_mask
) {
254 s
<< (empty
? "" : " ") << "(" << forAudioChannelMask(format
.channel_mask
) << ")";
259 if (format
.matrix_mask
!= media_multi_audio_format::wildcard
.matrix_mask
) {
260 s
<< (empty
? "" : " ") << "(" << forAudioMatrixMask(format
.matrix_mask
) << ")";
265 if (format
.byte_order
!= media_raw_audio_format::wildcard
.byte_order
) {
266 s
<< (empty
? "" : ", ") << forAudioByteOrder(format
.byte_order
);
271 if (format
.buffer_size
!= media_raw_audio_format::wildcard
.buffer_size
) {
272 s
<< (empty
? "" : ", ") << forAudioBufferSize(format
.buffer_size
);
280 BString
MediaString::getStringFor(
281 const media_raw_video_format
&format
,
283 D_METHOD(("MediaString::getStringFor(media_raw_video_format)\n"));
288 // format / color space
289 if (format
.display
.format
!= media_video_display_info::wildcard
.format
) {
290 s
<< (empty
? "" : ", ") << forVideoFormat(format
.display
.format
);
295 if ((format
.display
.line_width
!= media_video_display_info::wildcard
.line_width
)
296 && (format
.display
.line_count
!= media_video_display_info::wildcard
.line_count
)) {
297 s
<< (empty
? "" : ", ") << forVideoResolution(format
.display
.line_width
,
298 format
.display
.line_count
);
301 // field rate / interlace
302 if (format
.field_rate
!= media_raw_video_format::wildcard
.field_rate
) {
303 s
<< (empty
? "" : ", ") << forVideoFieldRate(format
.field_rate
,
311 if ((format
.pixel_width_aspect
!= media_raw_video_format::wildcard
.pixel_width_aspect
)
312 && (format
.pixel_height_aspect
!= media_raw_video_format::wildcard
.pixel_height_aspect
)) {
313 s
<< (empty
? "" : ", ") << forVideoAspectRatio(format
.pixel_width_aspect
,
314 format
.pixel_height_aspect
);
319 if (format
.orientation
!= media_raw_video_format::wildcard
.orientation
) {
320 s
<< (empty
? "" : ", ") << forVideoOrientation(format
.orientation
);
325 if ((format
.first_active
!= media_raw_video_format::wildcard
.first_active
)
326 && (format
.last_active
!= media_raw_video_format::wildcard
.last_active
)) {
327 s
<< (empty
? "" : ", ") << forVideoActiveLines(format
.first_active
,
335 BString
MediaString::getStringFor(
336 const media_encoded_audio_format
&format
,
338 D_METHOD(("MediaString::getStringFor(media_encoded_audio_format)\n"));
344 if (format
.bit_rate
!= media_encoded_audio_format::wildcard
.bit_rate
) {
345 s
<< (empty
? "" : ", ") << forAudioBitRate(format
.bit_rate
);
350 if (format
.frame_size
!= media_encoded_audio_format::wildcard
.frame_size
) {
351 s
<< (empty
? "" : ", ") << forAudioFrameSize(format
.frame_size
);
357 BString
MediaString::getStringFor(
358 const media_encoded_video_format
&format
,
360 D_METHOD(("MediaString::getStringFor(media_encoded_video_format)\n"));
366 if ((format
.avg_bit_rate
!= media_encoded_video_format::wildcard
.avg_bit_rate
)
367 && (format
.max_bit_rate
!= media_encoded_video_format::wildcard
.max_bit_rate
)) {
368 s
<< (empty
? "" : ", ") << forVideoBitRate(format
.avg_bit_rate
,
369 format
.max_bit_rate
);
376 if (format
.frame_size
!= media_encoded_video_format::wildcard
.frame_size
) {
377 s
<< (empty
? "" : ", ") << forVideoFrameSize(format
.frame_size
);
382 if ((format
.forward_history
!= media_encoded_video_format::wildcard
.forward_history
)
383 && (format
.backward_history
!= media_encoded_video_format::wildcard
.backward_history
)) {
384 s
<< (empty
? "" : ", ") << forVideoHistory(format
.forward_history
,
385 format
.backward_history
);
393 BString
MediaString::getStringFor(
394 const media_multistream_format
&format
,
396 D_METHOD(("MediaString::getStringFor(media_multistream_format)\n"));
402 if (format
.format
!= media_multistream_format::wildcard
.format
) {
403 s
<< (empty
? "" : ", ") << forMultistreamFormat(format
.format
);
408 if ((format
.avg_bit_rate
!= media_multistream_format::wildcard
.avg_bit_rate
)
409 && (format
.max_bit_rate
!= media_multistream_format::wildcard
.max_bit_rate
)) {
410 s
<< (empty
? "" : ", ") << forMultistreamBitRate(format
.avg_bit_rate
,
411 format
.max_bit_rate
);
418 if ((format
.avg_chunk_size
!= media_multistream_format::wildcard
.avg_chunk_size
)
419 && (format
.max_chunk_size
!= media_multistream_format::wildcard
.max_chunk_size
)) {
420 s
<< (empty
? "" : ", ") << forMultistreamChunkSize(format
.avg_chunk_size
,
421 format
.max_chunk_size
);
426 if (format
.flags
!= media_multistream_format::wildcard
.flags
) {
427 s
<< (empty
? "" : ", ") << forMultistreamFlags(format
.flags
);
435 BString
MediaString::getStringFor(
436 const media_format
&format
,
438 D_METHOD(("MediaString::getStringFor(media_format)\n"));
440 BString s
= getStringFor(format
.type
, complete
);
441 switch (format
.type
) {
442 case B_MEDIA_RAW_AUDIO
: {
443 BString formatInfo
= getStringFor(format
.u
.raw_audio
, complete
);
444 if (formatInfo
.Length() > 0)
445 s
<< " (" << formatInfo
<< ")";
448 case B_MEDIA_RAW_VIDEO
: {
449 BString formatInfo
= getStringFor(format
.u
.raw_video
, complete
);
450 if (formatInfo
.Length() > 0)
451 s
<< " (" << formatInfo
<< ")";
454 case B_MEDIA_ENCODED_AUDIO
: {
455 BString formatInfo
= getStringFor(format
.u
.encoded_audio
, complete
);
456 if (formatInfo
.Length() > 0)
457 s
<< " (" << formatInfo
<< ")";
460 case B_MEDIA_ENCODED_VIDEO
: {
461 BString formatInfo
= getStringFor(format
.u
.encoded_video
, complete
);
462 if (formatInfo
.Length() > 0)
463 s
<< " (" << formatInfo
<< ")";
466 case B_MEDIA_MULTISTREAM
: {
467 BString formatInfo
= getStringFor(format
.u
.multistream
, complete
);
468 if (formatInfo
.Length() > 0)
469 s
<< " (" << formatInfo
<< ")";
479 // -------------------------------------------------------- //
480 // *** media_source / media_destination strings (public)
481 // -------------------------------------------------------- //
483 BString
MediaString::getStringFor(
484 const media_source
&source
,
486 D_METHOD(("MediaString::getStringFor(media_source)\n"));
489 if ((source
.port
!= media_source::null
.port
)
490 && (source
.id
!= media_source::null
.id
)) {
491 s
<< "Port " << source
.port
<< ", ID " << source
.id
;
499 BString
MediaString::getStringFor(
500 const media_destination
&destination
,
502 D_METHOD(("MediaString::getStringFor(media_destination)\n"));
505 if ((destination
.port
!= media_destination::null
.port
)
506 && (destination
.id
!= media_destination::null
.id
)) {
507 s
<< "Port " << destination
.port
<< ", ID " << destination
.id
;
515 // -------------------------------------------------------- //
516 // *** strings for single fields in media_raw_audio_format
518 // -------------------------------------------------------- //
520 BString
MediaString::forAudioFormat(
523 D_METHOD(("MediaString::forAudioFormat()\n"));
525 if (format
== media_raw_audio_format::wildcard
.format
) {
530 case media_raw_audio_format::B_AUDIO_UCHAR
: {
531 return "8 bit integer";
533 case media_raw_audio_format::B_AUDIO_SHORT
: {
534 return "16 bit integer";
536 case media_raw_audio_format::B_AUDIO_FLOAT
: {
537 return "32 bit float";
539 case media_raw_audio_format::B_AUDIO_INT
: {
541 if (validBits
!= media_multi_audio_format::wildcard
.valid_bits
)
542 s
<< validBits
<< " bit ";
549 return "(unknown format)";
554 BString
MediaString::forAudioFrameRate(
557 D_METHOD(("MediaString::forAudioFrameRate()\n"));
559 if (frameRate
== media_raw_audio_format::wildcard
.frame_rate
) {
564 s
<< (frameRate
/ 1000) << " kHz";
568 BString
MediaString::forAudioChannelCount(
571 D_METHOD(("MediaString::forAudioChannelCount()\n"));
573 if (channelCount
== media_raw_audio_format::wildcard
.channel_count
) {
577 switch (channelCount
) {
586 s
<< channelCount
<< " Channels";
592 BString
MediaString::forAudioByteOrder(
595 D_METHOD(("MediaString::forAudioByteOrder()\n"));
597 if (byteOrder
== media_raw_audio_format::wildcard
.byte_order
) {
602 case B_MEDIA_BIG_ENDIAN
: {
605 case B_MEDIA_LITTLE_ENDIAN
: {
606 return "Little endian";
609 return "(unknown byte order)";
614 BString
MediaString::forAudioBufferSize(
617 D_METHOD(("MediaString::forAudioBufferSize()\n"));
619 if (bufferSize
== media_raw_audio_format::wildcard
.buffer_size
) {
624 s
<< bufferSize
<< " bytes per buffer";
628 BString
MediaString::forAudioChannelMask(
629 uint32 channelMask
) {
630 D_METHOD(("MediaString::forAudioChannelMask()\n"));
635 if (channelMask
& B_CHANNEL_LEFT
) {
641 if (channelMask
& B_CHANNEL_RIGHT
) {
648 list
<< ", " << last
;
652 if (channelMask
& B_CHANNEL_CENTER
) {
659 list
<< ", " << last
;
663 if (channelMask
& B_CHANNEL_SUB
) {
670 list
<< ", " << last
;
674 if (channelMask
& B_CHANNEL_REARLEFT
) {
681 list
<< ", " << last
;
685 if (channelMask
& B_CHANNEL_REARRIGHT
) {
692 list
<< ", " << last
;
696 if (channelMask
& B_CHANNEL_FRONT_LEFT_CENTER
) {
698 list
= "Front-left-center";
703 list
<< ", " << last
;
704 last
= "Front-left-center";
707 if (channelMask
& B_CHANNEL_FRONT_RIGHT_CENTER
) {
709 list
= "Front-right-center";
714 list
<< ", " << last
;
715 last
= "Front-right-center";
718 if (channelMask
& B_CHANNEL_BACK_CENTER
) {
720 list
= "Back-center";
725 list
<< ", " << last
;
726 last
= "Back-center";
729 if (channelMask
& B_CHANNEL_SIDE_LEFT
) {
736 list
<< ", " << last
;
740 if (channelMask
& B_CHANNEL_SIDE_RIGHT
) {
747 list
<< ", " << last
;
751 if (channelMask
& B_CHANNEL_TOP_CENTER
) {
758 list
<< ", " << last
;
762 if (channelMask
& B_CHANNEL_TOP_FRONT_LEFT
) {
764 list
= "Top-Front-left";
769 list
<< ", " << last
;
770 last
= "Top-Front-left";
773 if (channelMask
& B_CHANNEL_TOP_FRONT_CENTER
) {
775 list
= "Top-Front-center";
780 list
<< ", " << last
;
781 last
= "Top-Front-center";
784 if (channelMask
& B_CHANNEL_TOP_FRONT_RIGHT
) {
786 list
= "Top-Front-right";
791 list
<< ", " << last
;
792 last
= "Top-Front-right";
795 if (channelMask
& B_CHANNEL_TOP_BACK_LEFT
) {
797 list
= "Top-Back-left";
802 list
<< ", " << last
;
803 last
= "Top-Back-left";
806 if (channelMask
& B_CHANNEL_TOP_BACK_CENTER
) {
808 list
= "Top-Back-center";
813 list
<< ", " << last
;
814 last
= "Top-Back-center";
817 if (channelMask
& B_CHANNEL_TOP_BACK_RIGHT
) {
819 list
= "Top-Back-right";
824 list
<< ", " << last
;
825 last
= "Top-Back-right";
829 list
<< " & " << last
;
838 BString
MediaString::forAudioMatrixMask(
840 D_METHOD(("MediaString::forAudioMatrixMask()\n"));
842 switch (matrixMask
) {
843 case 0: return "(none)";
844 case B_MATRIX_PROLOGIC_LR
: return "ProLogic LR";
845 case B_MATRIX_AMBISONIC_WXYZ
: return "Ambisonic WXYZ";
846 default: return "(unknown matrix mask)";
850 // -------------------------------------------------------- //
851 // *** strings for single fields in media_encoded_audio_format
853 // -------------------------------------------------------- //
855 BString
MediaString::forAudioBitRate(
858 D_METHOD(("MediaString::forAudioBufferSize()\n"));
860 if (bitRate
== media_encoded_audio_format::wildcard
.bit_rate
) {
865 s
<< bitRate
/ 1000.0f
<< " kb/s";
869 BString
MediaString::forAudioFrameSize(
872 D_METHOD(("MediaString::forAudioFrameSize()\n"));
874 if (frameSize
== media_encoded_audio_format::wildcard
.frame_size
) {
879 s
<< frameSize
<< " bytes per frame";
883 // -------------------------------------------------------- //
884 // *** strings for single fields in media_raw_video_format
886 // -------------------------------------------------------- //
888 BString
MediaString::forVideoFormat(
891 D_METHOD(("MediaString::forVideoFormat()\n"));
893 if (format
== media_video_display_info::wildcard
.format
) {
899 case B_RGB32_BIG
: return "32 bit RGB";
901 case B_RGBA32_BIG
: return "32 bit RGBA";
903 case B_RGB24_BIG
: return "24 bit RGB";
905 case B_RGB16_BIG
: return "16 bit RGB";
907 case B_RGB15_BIG
: return "15 bit RGB";
909 case B_RGBA15_BIG
: return "15 bit RGBA";
910 case B_CMAP8
: return "8 bit color-index";
911 case B_GRAY8
: return "8 bit grayscale-index";
912 case B_GRAY1
: return "Monochrome";
913 case B_YUV422
: return "YUV422";
914 case B_YUV411
: return "YUV411";
915 case B_YUV420
: return "YUV420";
916 case B_YUV444
: return "YUV444";
917 case B_YUV9
: return "YUV9";
918 case B_YUV12
: return "YUV12";
919 case B_YCbCr422
: return "YCbCr422";
920 case B_YCbCr411
: return "YCbCr411";
921 case B_YCbCr444
: return "YCbCr444";
922 case B_YCbCr420
: return "YCbCr420";
923 case B_UVL24
: return "24 bit UVL";
924 case B_UVL32
: return "32 bit UVL";
925 case B_UVLA32
: return "32 bit UVLA";
926 case B_LAB24
: return "24 bit LAB";
927 case B_LAB32
: return "32 bit LAB";
928 case B_LABA32
: return "32 bit LABA";
929 case B_HSI24
: return "24 bit HSI";
930 case B_HSI32
: return "32 bit HSI";
931 case B_HSIA32
: return "32 bit HSIA";
932 case B_HSV24
: return "24 bit HSV";
933 case B_HSV32
: return "32 bit HSV";
934 case B_HSVA32
: return "32 bit HSVA";
935 case B_HLS24
: return "24 bit HLS";
936 case B_HLS32
: return "32 bit HLS";
937 case B_HLSA32
: return "32 bit HLSA";
938 case B_CMY24
: return "24 bit CMY";
939 case B_CMY32
: return "32 bit CMY";
940 case B_CMYA32
: return "32 bit CMYA";
941 case B_CMYK32
: return "32 bit CMYK";
943 return "(unknown video format)";
948 BString
MediaString::forVideoResolution(
952 D_METHOD(("MediaString::forVideoResolution()\n"));
954 if ((lineWidth
== media_video_display_info::wildcard
.line_width
)
955 || (lineCount
== media_video_display_info::wildcard
.line_count
)) {
960 s
<< lineWidth
<< " x " << lineCount
;
964 BString
MediaString::forVideoFieldRate(
968 D_METHOD(("MediaString::forVideoFieldRate()\n"));
970 if (fieldRate
== media_raw_video_format::wildcard
.field_rate
) {
975 if (interlace
== 1) {
976 s
<< "Non-interlaced ";
981 s
<< fieldRate
<< " Hz";
982 if ((fieldRate
> 49.9) && (fieldRate
< 50.1)) {
985 else if (((interlace
== 2) && (fieldRate
> 59.9) && (fieldRate
< 60.0))
986 || ((interlace
== 1) && (fieldRate
> 29.9) && (fieldRate
< 30.0))) {
993 BString
MediaString::forVideoOrientation(
996 D_METHOD(("MediaString::forVideoOrientation()\n"));
998 if (orientation
== media_raw_video_format::wildcard
.orientation
) {
1002 switch (orientation
) {
1003 case B_VIDEO_TOP_LEFT_RIGHT
: {
1004 return "Top to bottom, left to right";
1006 case B_VIDEO_BOTTOM_LEFT_RIGHT
: {
1007 return "Bottom to top, left to right";
1010 return "(unkown video orientation)";
1015 BString
MediaString::forVideoAspectRatio(
1019 D_METHOD(("MediaString::forVideoPixelAspect()\n"));
1021 if ((pixelWidth
== media_raw_video_format::wildcard
.pixel_width_aspect
)
1022 || (pixelHeight
== media_raw_video_format::wildcard
.pixel_height_aspect
)) {
1027 s
<< static_cast<uint32
>(pixelWidth
);
1028 s
<< ":" << static_cast<uint32
>(pixelHeight
);
1032 BString
MediaString::forVideoActiveLines(
1036 D_METHOD(("MediaString::forVideoActiveLines()\n"));
1038 if ((firstActive
== media_raw_video_format::wildcard
.first_active
)
1039 || (lastActive
== media_raw_video_format::wildcard
.last_active
)) {
1043 BString s
= "Video data between";
1044 s
<< " line " << firstActive
;
1045 s
<< " and " << lastActive
;
1049 BString
MediaString::forVideoBytesPerRow(
1052 D_METHOD(("MediaString::forVideoBytesPerRow()\n"));
1054 if (bytesPerRow
== media_video_display_info::wildcard
.bytes_per_row
) {
1059 s
<< bytesPerRow
<< " bytes per row";
1063 BString
MediaString::forVideoOffset(
1067 D_METHOD(("MediaString::forVideoResolution()\n"));
1070 if (pixelOffset
!= media_video_display_info::wildcard
.pixel_offset
) {
1071 s
<< pixelOffset
<< " pixels";
1073 if (lineOffset
!= media_video_display_info::wildcard
.line_offset
) {
1077 s
<< pixelOffset
<< " lines";
1085 // -------------------------------------------------------- //
1086 // *** strings for single fields in media_encoded_video_format
1088 // -------------------------------------------------------- //
1090 BString
MediaString::forVideoBitRate(
1094 D_METHOD(("MediaString::forVideoBitRate()\n"));
1097 if (avgBitRate
!= media_encoded_video_format::wildcard
.avg_bit_rate
) {
1098 s
<< avgBitRate
/ 1000.0f
<< " kb/s (avg)";
1100 if (maxBitRate
!= media_encoded_video_format::wildcard
.max_bit_rate
) {
1104 s
<< maxBitRate
/ 1000.0f
<< " kb/s (max)";
1112 BString
MediaString::forVideoFrameSize(
1115 D_METHOD(("MediaString::forVideoFrameSize()\n"));
1117 if (frameSize
== media_encoded_video_format::wildcard
.frame_size
) {
1122 s
<< frameSize
<< " bytes per frame";
1126 BString
MediaString::forVideoHistory(
1127 int16 forwardHistory
,
1128 int16 backwardHistory
)
1130 D_METHOD(("MediaString::forVideoHistory()\n"));
1133 if (forwardHistory
!= media_encoded_video_format::wildcard
.forward_history
) {
1134 s
<< static_cast<int32
>(forwardHistory
) << " frames forward";
1136 if (backwardHistory
!= media_encoded_video_format::wildcard
.backward_history
) {
1140 s
<< static_cast<int32
>(backwardHistory
) << " frames backward";
1148 // -------------------------------------------------------- //
1149 // *** strings for single fields in media_multistream_format
1151 // -------------------------------------------------------- //
1153 BString
MediaString::forMultistreamFormat(
1156 D_METHOD(("MediaString::forMultistreamFormat()\n"));
1158 if (format
== media_multistream_format::wildcard
.format
) {
1163 case media_multistream_format::B_VID
: return "BeOS video";
1164 case media_multistream_format::B_AVI
: return "AVI";
1165 case media_multistream_format::B_MPEG1
: return "MPEG1";
1166 case media_multistream_format::B_MPEG2
: return "MPEG2";
1167 case media_multistream_format::B_QUICKTIME
: return "QuickTime";
1168 default: return "(unknown multistream format)";
1172 BString
MediaString::forMultistreamBitRate(
1176 D_METHOD(("MediaString::forMultistreamFormat()\n"));
1179 if (avgBitRate
!= media_multistream_format::wildcard
.avg_bit_rate
) {
1180 s
<< avgBitRate
/ 1000.0f
<< " kb/s (avg)";
1182 if (maxBitRate
!= media_multistream_format::wildcard
.max_bit_rate
) {
1186 s
<< maxBitRate
/ 1000.0f
<< " kb/s (max)";
1194 BString
MediaString::forMultistreamChunkSize(
1195 uint32 avgChunkSize
,
1196 uint32 maxChunkSize
)
1198 D_METHOD(("MediaString::forMultistreamChunkSize()\n"));
1201 if (avgChunkSize
!= media_multistream_format::wildcard
.avg_chunk_size
) {
1202 s
<< avgChunkSize
<< " bytes (avg)";
1204 if (maxChunkSize
!= media_multistream_format::wildcard
.max_chunk_size
) {
1208 s
<< maxChunkSize
<< " bytes (max)";
1216 BString
MediaString::forMultistreamFlags(
1219 D_METHOD(("MediaString::forMultistreamFlags()\n"));
1224 if (flags
& media_multistream_format::B_HEADER_HAS_FLAGS
) {
1226 list
= "Header has flags";
1230 if (flags
& media_multistream_format::B_CLEAN_BUFFERS
) {
1232 list
= "Clean buffers";
1237 list
<< ", " << last
;
1238 last
= "Clean buffers";
1241 if (flags
& media_multistream_format::B_HOMOGENOUS_BUFFERS
) {
1243 list
= "Homogenous buffers";
1248 list
<< ", " << last
;
1249 last
= "Homogenous buffers";
1254 list
<< " & " << last
;
1262 // END -- MediaString.cpp --