100 Commits
Author SHA1 Message Date
Colin Günther 4ff7c2cc61 FFMPEG Plugin: Small refactoring in audio path.
- Lazy initializing the fDecodedData variable fits best in
  _ResetRawDecodedAudio() as fRawDecodedAudio is all about managing properties
  of fDecodedData. So fDecodedData having some memory allocated is seen as a
  property here.

- Updated documentation accordingly

- No functional change intended.
2014-08-25 14:33:45 +02:00
Colin Günther fe1eb3c1c1 FFMPEG Plugin: Fix performance regression on video path.
- For best performance the color conversion function expects a memory location
  aligned to 32 bytes. Without that alignment the color conversion function
  falls back to a slower conversion path. This fix was measured via
  DO_PROFILING and tested with various 1080p video files.
2014-08-25 14:33:41 +02:00
Colin Günther 1c5f18308c FFMPEG Plugin: Fix correct decoding of first video frame.
- The first decoded video frame was always zero bytes large, due to passing the
  wrong linesize to the color conversion function. The field containing the
  right linesize (fHeader.u.raw_video.bytes_per_row) simply wasn't initialized
  yet. Fix it by updating fHeader first before applying deinterlacing and color
  converting to the decoded video frame.
  Tested with mpeg2_decoder_test where the first picture now isn't empty
  (black) anymore.
2014-08-25 14:33:37 +02:00
Colin Günther f7f6702203 FFMPEG Plugin: Implement audio input buffer padding.
- Padding is required by FFMPEG for correct operation of all audio decoders.
  FFMPEG performs some speed optimizations under the hood that may lead to
  reading over the end of the chunk buffer wouldn't there have been padding
  applied.

- Resolve TODOs by unifying fVideoChunkBuffer and fChunkBuffer back into
  fChunkBuffer because audio path is responsible for freeing fChunkBuffer now.
  Resolved TODOs apply to the replacing fVideoChunkBuffer variable by
  fChunkBuffer, rename some methods by removing the "Video" part, collapse two
  methods into one (_LoadNextChunkIfNeededAndAssignStartTime()).
  No functional change intended.

- Enhance "logging stream to file" functionality to write to distinct logging
  files for audio and video. Before this commit one could only log video
  streams. But with unifying the _LoadNextChunkIfNeededAndAssignStartTime()
  audio streams gained the logging functionality for free. But now audio and
  video streams would be written in the same log file when watching a media
  file containing both audio and video. This is prevented by the distinct
  logging mentioned above.

- Update documentation accordingly.
2014-08-25 14:33:33 +02:00
Colin Günther 3c68ae7c58 FFMPEG Plugin: Refactor out copying of audio format properties.
- Main reasons for this refactoring of negotiation steps are to increase
  readability and to be on par with the video path.

- Rearrange some negotiation steps in video path to be on par with audio path.

- Add documentation for the new method and update existing documentation
  accordingly.

- No functional change intended.
2014-08-25 14:33:29 +02:00
Colin Günther 38738909a4 dvb.media_addon: Fix some coding style.
- Fix max line length, switch statement style and some pointer comparisons in
  if statements. No functional change intended.
  Note: There may be more coding style violations lurking.
2014-08-25 14:33:25 +02:00
Colin Günther 75a6d51e8a dvb.media_addon: Support dumping of the raw mpeg ts data.
- Main purpose is to debug a/v synchronization issues by playing the dumped
  mpeg ts data in alternative video players (like ffplay or MediaPlayer) and
  see how those behave.

- The commit diffs shows some coding style violations (max. line length) that
  show up throughout the whole DVBMediaNode class. Those will be fixed in the
  next commit to keep a clean separation between the different code changes.
2014-08-25 14:33:21 +02:00
Colin Günther ffb0f5db8e FFMPEG Plugin: Automatic detection of audio decoding parameters.
- Kudos to Marcus Overhagen for laying out the general idea of automatic
  detection by sharing some of his dvb code examples with me.
- Automatically detect the audio frame rate, channel count and sample format.
- Share audio sample format conversion code between AVFormatReader and
  AVCodecDecoder.
- Tested with several video and audio files via MediaPlayer.
- Tested also with test case mp3_decoder_test -after- removing the hard coded
  audio decoding parameters. Although the test shows that auto detection is
  working (via stepping through the auto detection code path) the complete test
  is still failing, due to missing implementation of incomplete audio frame
  decoding.
- Add and update the documentation accordingly.
2014-08-24 00:26:52 +02:00
Colin Günther 1a963de4e0 FFMPEG Plugin: Refactor out audio frames chunk decoding.
- Main purpose is to prepare auto detection of audio frame properties for
  media formats that encode those properties in the frames themself (e.g. MP3)
  instead of in the container format (e.g. WMA).
  The main difference between akin named methods _DecodeNextAudioFrame() and
  _DecodeNextAudioFrameChunk() is that the former method deals with providing
  the exact number of audio frames expected by the caller of
  BMediaDecoder::Decode() and the latter deals with decoding any number of
  audio frames at all.

- New documentation added and existing documentationupdated accordingly.

- No functional change intended.
2014-08-24 00:26:48 +02:00
Colin Günther 3c6f9c1087 FFMPEG Plugin: Fill out more media header fields in audio path.
- Some small refactoring when resetting fRawDecodedAudio. Instead of letting
  FFMPEG reset fRawDecodedAudio we do it manually to preserve the allocated
  memory in fRawDecodedAudio->opaque (otherwise FFMPEG's
  avcodec_get_frame_defaults() would NULLify the opaque pointer without
  releasing the allocated memory.

- Keep track of the total size of fDecodedData in fRawDecodedAudio->linesize[0]
  instead of relying on calculating it every time it is needed. This makes the
  code more comprehensible.
2014-08-24 00:26:44 +02:00
Colin Günther 1b8bbb509a FFMPEG Plugin: Refactor out checking of invalid conditions in audio path.
- Main reason for this refactoring is to increase readability and thus make
  audio decode path more comprehensible.

- Added documentation for the new method accordingly.

- Small change in calculating the decoded data size to clear when error occurs
  during decoding. This way it is more readable and more consistent with
  calculations of decoded data size on other locations.

- No functional change intended.
2014-08-22 23:34:13 +02:00
Colin Günther ca5c686d93 FFMPEG Plugin: Refactor out moving audio frames from buffer.
- Main reason for this refactoring is to increase readability and thus make the
  audio decode path more comprehensible.

- Added documentation for the new method accordingly.

- No functional change intended.
2014-08-22 23:34:09 +02:00
Colin Günther 7dc2773cff FFMPEG Plugin: Refactor out chunk loading in audio path.
- Main reasons are to increase readability of audio path and to demonstrate
  that chunk loading in audio and video path is the same code that can be
  focused in one method (instead of two at the moment). Added a TODO for
  collapsing both methods into one and the conditions that must hold true to
  do so (just in case I'll be hitted by a bus and someone else has to proceed).
  Collapsing is scheduled for a later commit.

- Added documentation for the new method accordingly.

- Make use of full line length in comments of
  _LoadNextVideoChunkIfNeededAndAssignStartTime().

- No functional change intended.
2014-08-22 23:34:05 +02:00
Colin Günther 463f34021e FFMPEG Plugin: Refactor out actual audio decoding part.
- Main reason for this refactoring is to increase readability and thus make the
  audio decode path more comprehensible.

- Added documentation for the new method accordingly.

- Small refactoring for detecting when to update fRawDecodedAudio's properties.
  This is a preparation step for factoring out the flushing of the
  fDecodedDataBuffer in a later commit.

- No functional change intended.
2014-08-22 23:34:01 +02:00
Colin Günther 815d18fb53 FFMPEG Plugin: Refactor start time handling in audio path.
- FFMPEG handles the relationship of start time between encoded and decoded
  audio data now by using the fTempPacket->dts and the
  fDecodedDataBuffer->pkt_dts fields. We still have to manually keep track of
  start times for consecutive audio frames though to support returning a number
  of audio frames that may assembled of partial AVFrames.

- The start time of the very first audio frame data packet returned by Decode()
  is now correctly calculated based on GetNextChunk() start times instead of
  being always zero.

- Introduce fRawDecodedAudio that serves as a container to store properties of
  the audio frames stored in fDecodedData. This prepares the population of the
  fHeader structure with audio frame properties needed to allow clients of
  BMediaDecoder::Decode() detect audio format changes in a later commit.

- Remove fStartTime as it is superflous now.
2014-08-21 21:46:22 +02:00
Colin Günther 8516a39e5d FFMPEG Plugin: Small cleanup
- The reason for compiler complaining about "INT64_C is not defined here" is
  gone since the addition of the compiler flag "-D__STDC_CONSTANT_MACROS"
  to the Jamfile some time ago. This flag allows C++ to use C99 math features.

- No functional change intended.
2014-08-21 21:46:18 +02:00
Colin Günther 7f485803cd FFMPEG Plugin: Print debug output for audio frames, too
- Also change what is printed for video frames. Currently both
  debug_fframe_[audio|video] are used in AVCodecDecoder only and thus are
  streamlined for their usage there. For example we print the AVFrame.pkt_dts
  field instead of the AVFrame.pkt field because the later one is never touched
  by AVCodecDecoders usage of the FFMPEG library.
  Note: AVFrame.pkt being never touched means that it always contains the value
  AV_NOPTS_VALUE making it less useful for debug purposes.
2014-08-21 21:46:14 +02:00
Colin Günther b82ef8bc15 FFMPEG Plugin: Refactor scope of fTempPacket in audio path.
- There are two main reasons for this refactoring:
    1. Prepare using FFMPEGs functionality of audio frame start time assignment
       (instead of rolling it ourself) like already done for the video path
       (see _LoadNextVideoChunkIfNeededAndAssignStartTime() for reference).
    2. Get rid of fChunkBufferOffset (this is a minor reason though).

- Untangle some of the conditional checks to increase readability.

- No functional change intended.
2014-08-21 00:47:06 +02:00
Colin Günther 3bca609810 FFMPEG Plugin: Rename some variables in audio path.
- Make the difference between fDecodedData and fDecodedDataBuffer more clear.

- No functional change intended.
2014-08-21 00:47:02 +02:00
Colin Günther 85371234ea FFMPEG Plugin: Refactor audio decoding method into two.
- First method is solely responsible to fill the audio output buffer with
  already decoded audio frames.
  Second method is solely responsible for decoding the encoded audio data and
  put it in the decoded audio output buffer for further processing with the
  first method.
  This prepares auto detection of audio frame properties for audio formats
  where the properties are contained within the encoded audio frame (e.g. MP3),
  instead within the audio container format (e.g. WMA). Implementing auto
  detection is scheduled for a later commit though.

- Added documentation accordingly.

- No functional change intended.
2014-08-21 00:46:58 +02:00
Colin Günther 54b392b4cc FFMPEG Plugin: Some cleanups.
- Use name that correctly reflects the return value of avcodec_decode_video2().
- Make DO_PROFILING code path of AVCodecDecoder compile again.
- No functional change intended.
2014-08-21 00:46:54 +02:00
Colin Günther ddde2c69c3 TV app: Use bilinear filtering.
- This makes the video output looks more visual appealing. Without bilinear
  filtering you would see aliasing artifacts all over the place. Now it looks
  more harmonic.
2014-08-20 12:23:03 +02:00
Colin Günther 740ede8c95 dvb.media_addon: Let C++ use C99 math features.
- This get rids of the complain "'UINT64_C' was not declared in this scope" and
  allows us to remove the (now superflous) declaration of UINT64_C.
- No functional change intended.
2014-08-20 12:23:02 +02:00
Colin Günther 75bd62e868 FFMPEG Plugin: Fix playing video files.
- This should fix the bug where video files that played well before the recent
  changes to the FFMPEG Plugin didn't play anymore. Now we apply the essential
  video container properties (that were passed by with Setup()) to the
  AVCodecContext. Some video formats simply store those properties in the
  container only (e.g. AVI, WMV) and not in the video frames itself
  (e.g. MPEG2).
  Tested with several files from samples.ffmpeg.org and from the FATE suite of
  FFMPEG.
2014-08-20 11:14:47 +02:00
Colin Günther 676721d267 FFMPEG Plugin: Fix video start_time generation.
- Ensure that start times are increased monotonically for video formats that
  contain B-frames, too, as expected by the BMediaDecoders.
  Previously start times were returned that seemed to go back in time for
  videos containing B-frames.
  Tested with resolutionchange.mpg (\see http://samples.ffmpeg.org/MPEG2)
  Note: Even though start times aren't going back in time anymore there are
  times where two consecutive start times are equal. This would need more
  research once this exposes a bug in a real application. Further more this
  might seem like a new bug, but before this commit the equal start times would
  have simply some different start time[s] in between. So at most this is the
  same bug just wearing new clothes :)

- Documentation updated accordingly.
2014-08-10 14:51:15 +02:00
Colin Günther ed9de7dfca FFMPEG Plugin: Fix video start_time handling
- I misinterpreted the semantics of reordered_opaque. I thought it would
  establish the correct relationship between the start_time returned by
  GetNextChunk() and the next video frame successfully decoded. But for this
  to work reordered_opaque expects to be filled with presentation time stamps.
  A series of presentation time stamps may be jumping back in time due to the
  presence of B-frames. The decoded frame presentation time stamps series would
  then be ordered in a monotonically increased way.
  But actually GetNextChunk() always returns monotonically increasing start
  times. Mapping this behaviour to FFMPEG's expectations means labeling those
  start times as decoding time stamps (dts). Though for those start times to be
  related to the correct decoded video frames you have to assign the start time
  with the AVPacket containing the data to be decoded.

- This commit finally makes DVB video playback working for me with the TV app.
  Though no audio yet.

- The documentation was updated accordingly.
2014-08-10 14:51:12 +02:00
Colin Günther b77f1724a2 FFMPEG Plugin: Calculate media_header.size_used field
- This field is needed by the dvb.media_addon to detect a format change so
  fill it with the correct value.
- Updated documentation accordingly to reflect reordered function calls and new
  assumptions based on the function call ordering.
2014-08-10 14:51:08 +02:00
Colin Günther 069bc5b597 dvb.media_addon: Stop changing format on every video frame.
- Due to comparing the wrong fields with one another the dvb.media_addon called
  ChangeFormat() on every new video frame.
- Also remove a duplicate print statement.
2014-08-10 14:51:04 +02:00
Colin Günther 97302390a0 dvb.media_addon: Remove superflous init check.
- This init check prevented the MediaStreamDecoder from setting up an input
  format. The values the init check is based on are initialized by the first
  call to BMediaDecoder::SetTo() as described in the BeBook ("If you use the
  empty form of the constructor, you'll have to call SetTo() to establish the
  format to be decoded before calling Decode()"). But MediaStreamDecoder
  doesn't provide a public way to call BMediaDecoder::SetTo() first.
  There are at least two possible solutions to remedy this situation:

  1. Remove the init check
  2. Add a public way to call SetTo()

  The first solution was chosen for the following reason: Least amount of
  code change needed as it is an implementation detail so no client code has
  to be touched.
  The second solution might make sence when you want to stick to the BeBook
  where a clear distinction between SetTo() and SetInputFormat() is made, but
  as the current MediaStreamDecoder implementation doesn't stick to the BeBook
  anyway there is less need to add another method at this time.
2014-08-10 14:51:00 +02:00
Colin Günther 7a8c70a3c8 dvb.media_addon: Trigger loading of media plugins.
- This is the workaround as described in the bug report #11018.
- I would have preferred to place this workaround in DVBMediaAddon::InitCheck()
  as this method can return a status code but unfortunately it is never called.
2014-08-10 14:50:57 +02:00
Colin Günther b93146243f dvb.media_addon: Code cleanup and some coding style.
- Remove use of now superflous media_header_ex structure.

- Respect 80 char line limit and indentation rules. Coding style only applied
  to functions raw_[audio|video]_thread, rest of the class may need some more
  cleanup.

- No functional change intended.
2014-08-10 14:50:53 +02:00
Colin Günther 6063c02ef9 FFMPEG Plugin: Fix bug and refactor input buffer padding.
- Fixes a bug using realloc with a memory area that is declared const which
  lead to a crash in MediaPlayer playing big_buck_bunny_720p_stereo.ogg.
- The refactoring introduces a strict separation between const memory areas
  (chunk data read from GetNextChunk()) and mutable memory areas
  (fVideoChunkBuffer) by using a copy operation instead of a casted
  assignment operation.
- Updated documentation accordingly.
- Besides fixing the bug, there is no functional change intended.
2014-08-06 14:28:40 +02:00
Colin Günther 6defcb6c6d FFMPEG Plugin: Refactor out loading next video chunk.
- Main reason for refactoring was to increase readability of
  _DecodeNextVideoFrame() by simplifying it. Refactoring was tested
  successfully for no functional change with mpeg2_decoder_test.
- Reindented the method definition in the header file so that the new method
  _LoadNextVideoChunkIfNeededAndUpdateStartTime() fits into 80 chars per line.
  Reindentdation is applied to methods only as the member variables have no
  space left for reindentation.
- Update documentation accordingly.
- Fix wording of audio part to audio path.
- No functional change intended.
2014-08-06 14:28:39 +02:00
Colin Günther 2d83b8419c FFMPEG Plugin: Implement video input buffer padding.
- Padding is required by FFMPEG for correct operation of all video decoders.
  FFMPEG performs some speed optimizations under the hood that may lead to
  reading over the end of the chunk buffer wouldn't there have been padding
  applied.
- Note: Padding is required for audio decoders, too. I will tackle this in some
  later commits. For the time being we have a degradation in code reuse, due to
  different memory ownership of chunk buffers in audio and video decoder path.
  Audio path must not care about freeing chunk buffers whereas video path must.
- Fix coding style and some typos.
- Update documentation accordingly.
2014-08-06 14:28:37 +02:00
Colin Günther a335ec823a FFMPEG Plugin: Implement flushing of video frames from decoder.
- Video frames still contained in the video decoder are now flushed when there
  are no encoded data chunks left (signaled by B_LAST_BUFFER_ERROR).
- New code was successfully tested with mpeg2_decoder_test. The last test image
  is now decoded, too, resulting in a bump of the expected number of decoded
  images.
- Refactor code to support flushing -and- keep the readability at a sane level.
- Remove some uncommented code for the sake of readability.
- Documentation updated accordingly.
2014-08-04 18:38:16 +02:00
Colin Günther 6a18ef8358 MediaKit: Remove superflous code in mpeg2_decoder_test.
- Thanks to automatic video decoding parameter detection, we no longer need to
  manually hack the correct parameters for this test to succeed, jiha!
2014-08-04 12:25:27 +02:00
Colin Günther 62320bdea2 FFMPEG Plugin: Automatic detection of video decoding parameters.
- Kudos to Marcus Overhagen for laying out the general idea of automatic
  detection by sharing some of his dvb code examples with me.
- Simplify pixel format search code by removing the loop and let FFMPEG
  decide what pixel format to use based on the actual video data.
- Automatically detect the video frame rate based on the actual video data.
- Remove fOutputVideoFormat to avoid synchronizing values in two distinct
  places. The member variable fHeader is the main place for important decoder
  parameters now.
- Introduce fOutputColorSpace containing the color space that was previously
  tracked in the fOutputVideoFormat member variable.
- Update the documentation accordingly.
2014-08-04 12:25:26 +02:00
Colin Günther 160f00bca8 FFMPEG Plugin: Implement video frame rate calculation for decoder.
- The frame rate calculation is purely based on AVCodecContext fields. This way
  the frame rate can be calculated by the FFMPEG decoder based on the actual
  video data. This is useful for automatically detection of the correct
  decoding parameters (not implemented yet but scheduled for a later commit).
- Not used anywhere yet (scheduled for a later commit).
- Also some minor documentation updates.
2014-08-04 12:25:25 +02:00
Colin Günther 60909c1e19 FFMPEG Plugin: Implement and use calculation of bytes per row. 2014-08-04 12:25:23 +02:00
Colin Günther 4f4d98911a FFMPEG Plugin: Extract video aspect ratio calculation code.
- Also make use of the extracted code in the AVCodecDecoder class.
- Enhance some documentation and fix some coding style violations.
- No functional change intended.
2014-08-04 12:25:22 +02:00
Colin Günther 22ea661b82 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)
2014-08-03 00:45:58 +02:00
Colin Günther f345d82773 FFMPEG Plugin: Code styles, typos and code deduplication.
- Kudos to stippi for taking the time pointing those out :)
  http://www.freelists.org/post/haiku-commits/haiku-hrev47576-srcaddonsmediapluginsffmpeg,1
- No functional change intended.

Signed-off-by: Colin Günther <[email protected]>
2014-07-29 17:54:04 +02:00
Colin Günther f783136274 FFMPEG-Plugin: Fix doxygen style and typo.
- No functional change intended.

Signed-off-by: Colin Günther <[email protected]>
2014-07-26 16:32:22 +02:00
Colin Günther 97f5a12f36 FFMPEG-Plugin: Simplify start time calculation of video frame.
- We let FFMPEG keep track of the correct relationship between presentation
  start time of the encoded video frame and the resulting decoded video frame.
  This simplyfies our code, meaning less lines of code to maintain :)

- Update documentation and pointing out some corner cases when calculating the
  correct presentation start time of a decoded video frame under certain
  circumstances.

- Fix doxygen: Use doxygen style instead of javadoc style.

- No functional change intended.

Signed-off-by: Colin Günther <[email protected]>
2014-07-26 16:32:18 +02:00
Colin Günther 254a53409e FFMPEG-Plugin: Refactor out update of media_header.
- Main purpose is to make reading the function DecodeNextFrame() easier on the
  eyes, by moving out auxiliary code.
  Note: The media_header update code for the start_time is still left in
  DecodeNextFrame(). This will be addressed in a later commit specially
  targetted on handling start_time calculations for incomplete video frames.

- Also updated / added some documentation.

- No functional change intended.

Signed-off-by: Colin Günther <[email protected]>
2014-07-26 16:32:13 +02:00
Colin Günther db59a66704 FFMPEG-Plugin: Implement decoding of streamed video data.
- This commit makes the mpeg2_decoder_test successfully decode the test video
  into 84 consecutive PNG images, yeah :)

- If this commit broke playing video files for you please file a bug report.
  I've tested only with one video file (big_buck_bunny_720p_stereo.ogg) that
  everything still works.

- The implementation has some shortcomings though, that will be addressed with
  some later commits:
    1. Start time of media header is wrongly calculated. At the moment we are
       using the start time of the first encoded data chunk we read via
       GetNextChunk(). This works only for chunk that contain one and exactly
       one frame, but not for chunks that contain the end or middle of a frame.
    2. Fields of the media header aren't updated when there is a format change
       in the middle of the video stream (for example the pixel aspect ratio
       might change in the middle of a DVB video stream (e.g. switch from 4:3
       to 16:9)).

- Also fix a potential bug, where the CODEC_FLAG_TRUNCATED flag was always
  set, due to missing brackets.

Signed-off-by: Colin Günther <[email protected]>
2014-07-26 16:32:09 +02:00
Colin Günther 70a9edbb11 FFMPEG plugin: Tell the FFMPEG library to handle incomplete data.
- It is just one flag that needs to be set, so that streaming video data can be
  handled by the FFMPEG library.

- For reference: This flag is based on FFMPEG's 0.10.2 video decode example
  (doc/example/decoding_encoding.c).

- The _DecodeNextVideoFrame() method needs to be adjusted (still to come), to
  take streamed data into account. So the flag on its own doesn't help, but it
  is a reasonable step in that direction.

Signed-off-by: Colin Günther <[email protected]>
2014-07-26 16:32:05 +02:00
Colin Günther 0adda4f68f FFMPEG plugin: Refactor video decoding function.
- Factor out the deinterlacing and color converting part to make the code more
  readable. This makes it easier to understand which code belongs to the actual
  decoding process and which code to the post processing.

- There seems to be no performance impact involved (I just looked at the spikes
  of the process manager) in factoring out this part, but one can always inline
  the method if a closer performance assesment (e.g. by enabling the profiling
  the existing profiling code) suggests so.

- Document the _DecodeVideo() method a little bit. Maybe someone can document
  the info parameter, as I'm a little bit clueless here.

- No functional change intended.

Signed-off-by: Colin Günther <[email protected]>
(cherry picked from commit c5fa095fa73d47e75a46cfc138a56028fcc01819)
2014-07-26 16:32:01 +02:00
Colin Günther 172c55faf1 FFMPEG plugin: Refactor video decoding function.
- We factor out the code that does the decoding, deinterlacing and color space
  converting into its own function. This prepares auto detection of video frame
  properties in a later commit. Auto detection means (for example), that you
  don't need to know the size of the decoded video frame -before- intitializing
  the video codec as it is the case with the current implementation.

- Use the already existent private member variable fHeader to fill out and
  return video frame properties.

- Rename some variables to be more self describing.

- No functional change intended.

Signed-off-by: Colin Günther <[email protected]>
(cherry picked from commit 6beab04f48e98022041895750f38c5a35a5f4f9e)
2014-07-15 15:49:22 +02:00
Colin Günther 29da3b5548 FFMPEG plugin: Add links to useful FFMPEG-API documentation.
- As it is rather hard to find useful documentation, on how to use FFMPEG's API
  we cut of some research time by just documenting it at the place where it is
  most visible to other FFMPEG plugin developers :)

Signed-off-by: Colin Günther <[email protected]>
(cherry picked from commit b0ed15d2196ca45de8ab2d5913d760602aacc5f3)
2014-07-15 15:49:17 +02:00
Colin Günther 9e52cc7480 FFMPEG plugin: Use member variables instead of local ones.
- This small refactoring is in preparation for implementing decoding of partial
  video frame data, where one needs to preserve encoded data between multiple
  calls to  AVCodecDecoder::_DecodeVideo().

- Note: The names fChunkBuffer and fChunkBufferSize are open for discussion.
  I'd rather prefer fEncodedDataChunkBuffer and fEncodedDataChunkBufferSize.
  But I'd like to take small refactoring steps, and changing the naming would
  also touch the AVCodecDecoder::_DecodeAudio() function. I'd rather focus
  on improving the video part for now, leaving the audio part alone.

- No functional change intended.

Signed-off-by: Colin Günther <[email protected]>
(cherry picked from commit f2da1e752458b926aebe50642bf6af19e9903f17)
2014-07-15 15:49:13 +02:00
Colin Günther d65388e7fa Media Kit: Add workaround for #11018 to MP3 audio stream decoder test.
The workaround triggers the loading of all media plugins prior to using
methods of class BMediaFormats. Using the function get_next_encoder()
is used because of two facts

1. It is publicly available and thus can be used by 3rd party apps,
   too.
2. It is already available by including BMediaFormats.h, so there is
   no need to include another header for this workaround.

Signed-off-by: Colin Günther <[email protected]>
(cherry picked from commit a89b0a4e69f18b2b3b2c2f5615450a5ddac838af)
2014-07-09 19:06:27 +02:00
Colin Günther 50b586b9de Media Kit: Add workaround for #11018 to MPEG2 video stream decoder test.
The workaround triggers the loading of all media plugins prior to using
methods of class BMediaFormats. Using the function get_next_encoder()
is used because of two facts

1. It is publicly available and thus can be used by 3rd party apps,
   too.
2. It is already available by including BMediaFormats.h, so there is
   no need to include another header for this workaround.

Signed-off-by: Colin Günther <[email protected]>
(cherry picked from commit 80354716fe8b25c81ec45bd96ae36e171228b8a0)
2014-07-09 19:06:12 +02:00
Colin Günther 366ee54830 DVB media addon: Fix debug build.
- Compiling dvb.media_addon with DEBUG on fails with error message:
    generated/objects/haiku/x86/debug_1/add-ons/media/media-add-ons/dvb/
    MediaFormat.o: In function `av_log2_c': /boot/home/Development/haiku-a4/
    generated/build_packages/ffmpeg-0.10.2-r1a4-x86-gcc2-2012-08-30/common/
    include/libavutil/common.h:80: undefined reference to `ff_log2_tab'
    collect2: ld returned 1 exit status"

- Research done to narrow down the solution space:
    - ff_log2_tab is a array that is nowhere needed in the dvb.media_addon
    - ff_log2_tab is defined as an extern array in the ffmpeg header file
      libavutil/common.h
    - ff_log2_tab is used in the inline function av_log2_c (libavutil/common.h)
      which doesn't get optimized away when compiling with debug information
    - MediaFormat.cpp needs only some Codec-IDs from the ffmpeg header file
      avcodec.h

- The following fixes were tried:
    - Trying to eliminate unused debug symbols with compilation
      flag -feliminate-unused-debug-types (see gcc documentation
      http://gcc.gnu.org/onlinedocs/gcc-4.1.2/gcc/Debugging-Options.html#Debugging-Options)
      by adding the following lines to UserBuildConfig
          AppendToConfigVar C++FLAGS : HAIKU_TOP src : -feliminate-unused-debug-types : global ;
          AppendToConfigVar CCFLAGS : HAIKU_TOP src : -feliminate-unused-debug-types : global ;
      -> Failed, because flag -feliminate-unused-debug-types is not supported by GCC 2.95.3

    - Trying to eliminate unused debug symbols in the linker stage
      -> This worked, by removing the LINKFLAG "-Xlinker --no-undefined" when
         linking all objects into the dvb.media_addon we are getting our addon
         with debug symbols.

- Final solution:
    - Instead of adding/removing flags, we just add the missing implementation
      for the ff_log2_tab array in MediaFormat.cpp. This -feels- the seems to
      be the cleanest solution as it is more obvious what's goin' on compared
      to hiding the solution in the Jamfile.

Signed-off-by: Colin Günther <[email protected]>
2014-07-09 19:05:00 +02:00
Colin Günther 7a28891db4 Media Kit: Add MP3 audio stream decoder test.
- This test currently fails and thus showing that there is something wrong in
  the Media Kit.
- This test was first developed and tested on Haiku R1 Alpha 4.1 where
  every thing was hacked together to make this test succeed, thus showing that
  the current Media Kit state of affair has some issues and not this test :)
- The test comes with documentation (@see mp3_decoder_test.cpp).

Signed-off-by: Colin Günther <[email protected]>
2014-07-06 13:51:35 +00:00
Colin Günther c5954368ed Media Kit: Add MPEG2 video stream decoder test.
- This test currently fails and thus showing that there is something wrong in
  the Media Kit.
- This test was first developed and tested on Haiku R1 Alpha 4.1 where
  every thing was hacked together to make this test succeed, thus showing that
  the current Media Kit state of affair has some issues and not this test :)
- The test comes with documentation (@see mpeg2_decoder.test.cpp).

Signed-off-by: Colin Günther <[email protected]>
2014-07-06 13:51:31 +00:00
Colin Günther bda76e2de0 Adding the new ralink 2860 driver. Testet on Christof Lutteroth's Eee PC 901.
Thx for letting me hack on it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39093 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-23 20:34:26 +00:00
Colin Günther 560626ba87 Cody style fixes. No functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39091 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-23 20:28:38 +00:00
Colin Günther fcde9e72e1 * Add a function needed by the ralink 2860 driver.
* Fix a compiler warning about missing braces.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39089 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-23 20:25:17 +00:00
Colin Günther 7965271acd * Removing superflous Makefile.
* Modify driver source to allow correct interrupt processing.
* Add glue file to make driver load in Haiku.
* Update build files accordingly.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39088 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-23 20:24:02 +00:00
Colin Günther 974d4226ff Copy the ralink 2860 source code into place.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39085 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-10-23 20:13:39 +00:00
Colin Günther e4a0a9c2b4 Updating the atheroswifi driver to the FreeBSD HEAD svn rev 204100. This enables
support for some of the newer 9k chipsets. For example my Eee PC 1005 HA can
now be used with WiFi.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35747 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-03 21:55:51 +00:00
Colin Günther 1d2ac9a4ea Fixing coding style violation. No functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35712 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-01 22:13:33 +00:00
Colin Günther 2eb71b4eaa Indent the comments to line up with the _AddPackageCredit() method. Should have
been part of r35691, where I applied a patch by mmadia taken from ticket #5457
(which was previously closed by bonefish), with some modifications by me.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35692 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-01 01:10:24 +00:00
Colin Günther 6f144451ab Adding copyright information of WiFi firmwares to AboutSystem.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35691 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-01 01:03:53 +00:00
Colin Günther 87a93eb887 * Adding all remaining wifi drivers.
* List them in alphabetical order.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35689 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-03-01 00:43:13 +00:00
Colin Günther 3c08c615dc * Broken build detected by mmadia: When compiling with jam -j8 the atheroswifi
driver may not build due to dependencies to the kernel_c++_structs.h header.
  Normally this header is build by jam when building the libfreebsd_network.a
  library, with the first network driver so to speak.
  Adding a rule to the atheroswifi Jamfile to build kernel_c++_structs.h
  would be the wrong fix, because the atheroswifi doesn't need condition
  variables.
  The correct fix is to remove the #include <condvar.h> statement from proc.h.
  And while I'm at it, I remove all the other include statements, too, as none
  of them are needed by this header (all drivers are still compiling).
* Thank you mmadia for the heads up.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35349 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-30 19:04:45 +00:00
Colin Günther 8a249cd5ad * Recursive dependencies are now correctly handled, so Subversion and BeHappy
should now be able to be installed gracefully. This fixes ticket #5248.
* Enhancement of the -a parameter, so that it accepts multiple packages at once.
  Multiple packages have to be included in double quotes, due to the way getopts
  handles options. This fixes ticket #5315.
* Thanks mmadia for this patch!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35327 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-28 11:25:25 +00:00
Colin Günther 48e129c9d4 White space cleanup. No functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35213 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-21 10:07:25 +00:00
Colin Günther 0541219b59 Applying patch by mmadia. This fixes ticket #5299. Thank you!
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35185 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-19 22:05:18 +00:00
Colin Günther 396abf076f * Adapting firmware based driver to the new firmware name mapping method.
* Removing the respective settings files, as they are no longer needed.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35171 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-19 17:49:45 +00:00
Colin Günther d3806c1b62 * Reworked firmware loading. This gets rid of the need for the settings files.
Name mapping is now defined in the glue code.
* Adding two macros for handling firmware name mapping completely in the glue
  code:
  - HAIKU_FIRMWARE_NAME_MAP(firmwarePartsCount) is used when mapping is
    required. Have a look to iprowifi2100's glue code for an example.
  - NO_HAIKU_FIRMWARE_NAME_MAP() is used when the firmware names don't need to
    be mapped. For example: broadcom43xx
* Discard usage of vm_map_file() and use the previously read() method again.
  After Axel and Ingo agree that both methods are fine in this particular use
  case, using read() looks easier on the eye. It needs only 3 parameters, where
  vm_map_file() takes 10.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35170 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-19 17:44:38 +00:00
Colin Günther 81a0bf6fdc Adding a wifi firmware installation script done by mmadia. This script installs
firmware for unshipable broadcom43xx and marvell88w8335. Furthermore it installs
the firmware for ipw2100 and iprowifi2200, which requires the user to consent
to its license terms. Thank you mmadia!


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35164 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-19 10:17:33 +00:00
Colin Günther 9c17873558 Adding firmware licenses for shipable firmwares. This fulfills a requirement of
AboutSystem and the install-wifi-firmwares script.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35162 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-19 10:13:27 +00:00
Colin Günther 0b97b70b5c * Adding shipable firmwares to the repository. They aren't included in the
nightlies, though. As this will require an update of AboutSystem, which is
  scheduled for a later commit.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35160 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-19 09:58:11 +00:00
Colin Günther 6754b03459 Another driver settings file. Should have been part of r35158.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35159 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-19 09:45:28 +00:00
Colin Günther 3dc8c9b9ae Adding driver settings file with the firmware name mappings. Those files need
to be copied to /home/config/settings/kernel/drivers with omitting the file
endings.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35158 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-19 09:44:02 +00:00
Colin Günther b6dd23b149 Reverting to original firmware naming scheme. You now just have to extract
the Intel provided firmware archive in /system/data/firmware/ipw2100/ with out
the need of any renaming.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35157 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-19 09:15:27 +00:00
Colin Günther 865639deac * Changing the naming scheme for firmwares. Instead of directly renaming
the respective firmware files renaming is now done within the firmware loader.
  The mapping of original firmware names to FreeBSD internal firmware names is
  now done within driver specific settings files. Those are committed in a next
  step.
  This approach allows a clean separation of FreeBSD compat layer requirements
  and native driver requirements.
  For example: we have two Intel PRO/Wireless 2100 drivers. Do we prefer the
  naming scheme of the native driver or do we force the native driver to use
  the one of the FreeBSD driver? With this commit we prefer native over FreeBSD.
* Changed the firmware loader to make use of Haiku's file mapping facility.
* Implementing firmware unloading.
* Some minor cleanups in two compat layer header files, which are using Haiku
  defined identifiers, where apropriate.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35156 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-19 09:08:52 +00:00
Colin Günther 50b6d555c2 Adding svn property svn:executable do make the script executable. Thx Humdinger
for the heads up.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35068 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-14 08:27:22 +00:00
Colin Günther ae8d7c50e5 Patch by mmadia: Adding installoptionalpackage to HaikuImage. This is a
temporary solution as long as there is no package manager available. When
executing the script, it mentions this, too. This fixes #4680. Thank you.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35041 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-13 08:30:35 +00:00
Colin Günther ac20a24e6f Adding strndup.cpp to kernel_lib_posix. Introduced for having a safe way
duplicating firmware names in firmware_get() of the freebsd compat layer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34844 a95241bf-73f2-0310-859d-f6bbb57e9c96
2010-01-01 22:05:45 +00:00
Colin Günther 1e84402302 * Adjusting firmware path of Haiku's native Intel PRO/Wireless 2100 driver,
so that it can make use of the firmware installed by the OptionalPackage
  Wifi-ipw2100+fw.
* Updating OptionalPackages to use the latest Wifi-ipw2100+fw package.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34833 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-31 20:39:27 +00:00
Colin Günther 8d84a92032 Coding style cleanup. No functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34824 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-30 09:04:01 +00:00
Colin Günther 485da29cbc Found a better solution for implementing ieee80211_node_dectestref().
Now the reference count get accessed only once, leading to true atomarity.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34823 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-30 01:00:51 +00:00
Colin Günther 210124c810 Switching from atomic_{and|or} or to atomic_{set|get} as this reads more
natural and spares even one atomic call in syskonnect.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34822 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-30 00:45:16 +00:00
Colin Günther 5ce504e289 * Reworked scanner registration. Scanners are getting cleanly unregistered
on wlan stack shutdown, now.
* Added patch by mmlr to support IBSS (aka Ad-hoc) mode. To activate IBSS mode
  one would need recompile the wlan stack, though, once the constant in
  start_wlan() is switched from IEEE80211_M_STA to IEEE80211_M_IBSS. There is
  no runtime configuration, yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34821 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-30 00:37:23 +00:00
Colin Günther bfaa8fac89 Fixed typo. This will make iprowifi2200 compile again.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34820 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-30 00:30:56 +00:00
Colin Günther c006bb2735 * Using conditional compilation instead of simply deleting source code, to
ensure interrupts are disabled only once per interrupt event.
* Coding style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34819 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-29 23:46:42 +00:00
Colin Günther 75b892d51f * Ensuring that interrupts are disabled only once per interrupt.
* Coding style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34818 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-29 23:00:42 +00:00
Colin Günther f8762ee71c Cody style cleanup. Thanx Axel for the headup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34817 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-29 22:56:24 +00:00
Colin Günther f9ee2947df * Using atomic_{get|set} instead of HAIKU_INTR* macros.
* Using conditional compiliation instead of just deleting original code
  to easen future driver updates.
* Coding style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34816 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-29 22:48:07 +00:00
Colin Günther 8645a5715e * Ensuring reading of interrupt status is done only once.
* Code style cleanup.
* Automatic white space cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34815 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-29 22:31:43 +00:00
Colin Günther 2d939304db * Ensuring that reading interrupt status register and disabling interrupts
is done only once.
* Coding style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34814 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-29 22:20:54 +00:00
Colin Günther 0e39b0b7ce Using atomic_{set|get} as proposed by Axel.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34813 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-29 22:10:04 +00:00
Colin Günther b69688c36e * Reworked interrupt handlink so that the interrupt status is read only once
per interrupt. Moreover the interrupt is disabled only once now too.
* Using atomic_{set|get} operations for synchronizing the interrupt status
  as proposed by Axel.
* Coding style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34812 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-29 22:00:28 +00:00
Colin Günther 168aaf2f9d * Using atomic operations to synchronize the interrupt status between glue code
and ath_intr function. Those are faster than the HAIKU_INTR* macros.
* Some variable renaming to stick with common naming conventions of the other
  wlan drivers.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34811 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-29 18:24:35 +00:00
Colin Günther 097be0a818 Codestyle cleanup. No functional change.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34810 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-29 18:15:39 +00:00
Colin Günther 6e12370632 * Disable interrupts only once, to prevent misbehaviour of hardware. Though
I don't know about such hardware, it is better to be cautious here.
* Code style cleanup.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34809 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-29 18:12:17 +00:00
Colin Günther ed36d5dfa2 Using the same pointer orientation as the rest of the code. No functional
change.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@34808 a95241bf-73f2-0310-859d-f6bbb57e9c96
2009-12-29 18:01:33 +00:00