2022-08-26 15:44:59 +00:00
|
|
|
// Copyright 2015 Google LLC. All rights reserved.
|
2015-11-20 19:28:45 +00:00
|
|
|
//
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file or at
|
|
|
|
// https://developers.google.com/open-source/licenses/bsd
|
|
|
|
|
2017-12-20 00:56:36 +00:00
|
|
|
#ifndef PACKAGER_MEDIA_CODECS_VPX_PARSER_H_
|
|
|
|
#define PACKAGER_MEDIA_CODECS_VPX_PARSER_H_
|
2015-11-20 19:28:45 +00:00
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2022-12-16 00:53:36 +00:00
|
|
|
#include "packager/macros.h"
|
2016-05-25 18:03:17 +00:00
|
|
|
#include "packager/media/codecs/vp_codec_configuration_record.h"
|
2015-11-20 19:28:45 +00:00
|
|
|
|
2016-05-20 21:19:33 +00:00
|
|
|
namespace shaka {
|
2015-11-20 19:28:45 +00:00
|
|
|
namespace media {
|
|
|
|
|
|
|
|
struct VPxFrameInfo {
|
|
|
|
size_t frame_size;
|
|
|
|
size_t uncompressed_header_size;
|
|
|
|
bool is_keyframe;
|
|
|
|
uint32_t width;
|
|
|
|
uint32_t height;
|
|
|
|
};
|
|
|
|
|
|
|
|
class VPxParser {
|
|
|
|
public:
|
|
|
|
VPxParser() {}
|
|
|
|
virtual ~VPxParser() {}
|
|
|
|
|
|
|
|
/// Parse @a data with size @a data_size.
|
|
|
|
/// @param data_size Size of the sample in bytes. Note that it should be a
|
|
|
|
/// full sample.
|
|
|
|
/// @param[out] vpx_frames points to the list of VPx frames for the current
|
|
|
|
/// sample on success. Cannot be NULL.
|
|
|
|
/// @return true on success, false otherwise.
|
|
|
|
virtual bool Parse(const uint8_t* data,
|
|
|
|
size_t data_size,
|
|
|
|
std::vector<VPxFrameInfo>* vpx_frames) = 0;
|
|
|
|
|
|
|
|
/// @return VPx codec configuration extracted. Note that it is only valid
|
|
|
|
/// after parsing a keyframe or intra frame successfully.
|
2016-05-25 17:33:53 +00:00
|
|
|
const VPCodecConfigurationRecord& codec_config() const {
|
|
|
|
return codec_config_;
|
|
|
|
}
|
2015-11-20 19:28:45 +00:00
|
|
|
|
|
|
|
protected:
|
2016-05-25 17:33:53 +00:00
|
|
|
VPCodecConfigurationRecord* writable_codec_config() { return &codec_config_; }
|
2015-11-20 19:28:45 +00:00
|
|
|
|
|
|
|
private:
|
2016-05-25 17:33:53 +00:00
|
|
|
VPCodecConfigurationRecord codec_config_;
|
2015-11-20 19:28:45 +00:00
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(VPxParser);
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace media
|
2016-05-20 21:19:33 +00:00
|
|
|
} // namespace shaka
|
2015-11-20 19:28:45 +00:00
|
|
|
|
2017-12-20 00:56:36 +00:00
|
|
|
#endif // PACKAGER_MEDIA_CODECS_VPX_PARSER_H_
|