From 22ea661b82e5e8921d1f65114fb0d8c07296aedc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Colin=20G=C3=BCnther?= Date: Fri, 1 Aug 2014 23:32:36 +0200 Subject: [PATCH] MediaKit: Extend media_[audio|video]_header structures. - This allows a BMediaDecoder (e.g. FFMPEG Plugin) to communicate back format changes to its clients. For a more thorough explanation and discussion see haiku-development mailing list: http://www.freelists.org/post/haiku-development/Request-for-protest-Media-Kit-Extend-media-header-struct - Backwards compatibility is taken into account and preserved by reducing the relevant _reserved[] fields. - Code changes that will actually make use of these extensions are due for the following commits. As these structure extensions affect several Haiku components (e.g. media_server, MediaPlayer, etc.) and third party apps (e.g. StampTV, etc.) I refrain from committing them in one batch with this commit. This should make it easier to track down bugs originating in this code change. (cherry picked from commit 806b6888d2dcf84b4934f8f137a48d3381864d1c) --- headers/os/media/MediaDefs.h | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/headers/os/media/MediaDefs.h b/headers/os/media/MediaDefs.h index f40e7ab181..8cbce1e270 100644 --- a/headers/os/media/MediaDefs.h +++ b/headers/os/media/MediaDefs.h @@ -280,8 +280,11 @@ struct media_raw_audio_format { struct media_audio_header { - // TODO: Define this structure, put actual data at the end - int32 _reserved_[16]; + // TODO: Refine this structure and put actual data at the end + int32 _reserved_[14]; + float frame_rate; + uint32 channel_count; + }; @@ -391,8 +394,16 @@ struct media_raw_video_format { struct media_video_header { - uint32 _reserved_[12]; // NOTE: Keep reserved data at the top! + uint32 _reserved_[8]; // NOTE: Keep reserved data at the top! + uint32 display_line_width; // Number of pixels per display_line + uint32 display_line_count; // Sum of all interlace fields lines + uint32 bytes_per_row; // Number of bytes in a display_line + // (padding bytes excluded) + uint16 pixel_width_aspect; // 1:1 has 1 here, 4:3 has 4 here + // 16:9 has 16 here! + uint16 pixel_height_aspect;// 1:1 has 1 here, 4:3 has 3 here + // 16:9 has 9 here! float field_gamma; uint32 field_sequence; // Sequence number since start of capture // May roll over if machine is on for a