You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
3.5 KiB

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
  1. /*
  2. * Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
  3. *
  4. * Use of this source code is governed by a BSD-style license
  5. * that can be found in the LICENSE file in the root of the source
  6. * tree. An additional intellectual property rights grant can be found
  7. * in the file PATENTS. All contributing project authors may
  8. * be found in the AUTHORS file in the root of the source tree.
  9. */
  10. #ifndef MODULES_VIDEO_CODING_ENCODED_FRAME_H_
  11. #define MODULES_VIDEO_CODING_ENCODED_FRAME_H_
  12. #include <vector>
  13. #include "api/video/encoded_image.h"
  14. #include "modules/rtp_rtcp/source/rtp_video_header.h"
  15. #include "modules/video_coding/include/video_codec_interface.h"
  16. #include "modules/video_coding/include/video_coding_defines.h"
  17. namespace webrtc {
  18. class VCMEncodedFrame : protected EncodedImage {
  19. public:
  20. VCMEncodedFrame();
  21. VCMEncodedFrame(const VCMEncodedFrame&);
  22. ~VCMEncodedFrame();
  23. /**
  24. * Set render time in milliseconds
  25. */
  26. void SetRenderTime(const int64_t renderTimeMs) {
  27. _renderTimeMs = renderTimeMs;
  28. }
  29. /**
  30. * Set the encoded frame size
  31. */
  32. void SetEncodedSize(uint32_t width, uint32_t height) {
  33. _encodedWidth = width;
  34. _encodedHeight = height;
  35. }
  36. void SetPlayoutDelay(PlayoutDelay playout_delay) {
  37. playout_delay_ = playout_delay;
  38. }
  39. /**
  40. * Get the encoded image
  41. */
  42. const webrtc::EncodedImage& EncodedImage() const {
  43. return static_cast<const webrtc::EncodedImage&>(*this);
  44. }
  45. using EncodedImage::ColorSpace;
  46. using EncodedImage::data;
  47. using EncodedImage::PacketInfos;
  48. using EncodedImage::set_size;
  49. using EncodedImage::SetColorSpace;
  50. using EncodedImage::SetEncodedData;
  51. using EncodedImage::SetPacketInfos;
  52. using EncodedImage::SetSpatialIndex;
  53. using EncodedImage::SetSpatialLayerFrameSize;
  54. using EncodedImage::SetTimestamp;
  55. using EncodedImage::size;
  56. using EncodedImage::SpatialIndex;
  57. using EncodedImage::SpatialLayerFrameSize;
  58. using EncodedImage::Timestamp;
  59. /**
  60. * Get render time in milliseconds
  61. */
  62. int64_t RenderTimeMs() const { return _renderTimeMs; }
  63. /**
  64. * Get frame type
  65. */
  66. webrtc::VideoFrameType FrameType() const { return _frameType; }
  67. /**
  68. * Get frame rotation
  69. */
  70. VideoRotation rotation() const { return rotation_; }
  71. /**
  72. * Get video content type
  73. */
  74. VideoContentType contentType() const { return content_type_; }
  75. /**
  76. * Get video timing
  77. */
  78. EncodedImage::Timing video_timing() const { return timing_; }
  79. EncodedImage::Timing* video_timing_mutable() { return &timing_; }
  80. /**
  81. * True if this frame is complete, false otherwise
  82. */
  83. bool Complete() const { return _completeFrame; }
  84. /**
  85. * True if there's a frame missing before this frame
  86. */
  87. bool MissingFrame() const { return _missingFrame; }
  88. /**
  89. * Payload type of the encoded payload
  90. */
  91. uint8_t PayloadType() const { return _payloadType; }
  92. /**
  93. * Get codec specific info.
  94. * The returned pointer is only valid as long as the VCMEncodedFrame
  95. * is valid. Also, VCMEncodedFrame owns the pointer and will delete
  96. * the object.
  97. */
  98. const CodecSpecificInfo* CodecSpecific() const { return &_codecSpecificInfo; }
  99. void SetCodecSpecific(const CodecSpecificInfo* codec_specific) {
  100. _codecSpecificInfo = *codec_specific;
  101. }
  102. protected:
  103. void Reset();
  104. void CopyCodecSpecific(const RTPVideoHeader* header);
  105. int64_t _renderTimeMs;
  106. uint8_t _payloadType;
  107. bool _missingFrame;
  108. CodecSpecificInfo _codecSpecificInfo;
  109. webrtc::VideoCodecType _codec;
  110. };
  111. } // namespace webrtc
  112. #endif // MODULES_VIDEO_CODING_ENCODED_FRAME_H_