mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-10 02:08:38 +09:00
Issue #2357 - WebM demuxer can't tell when a video wants to be transparent.
Required to have an alpha channel (which in the strange world of graphics seems to refer to transparency, and not experimental code) in WebM videos. Straight port of Firefox 53 implementation, adapted slightly for a couple of patches previously taken without this. Ref: BZ 1320829
This commit is contained in:
parent
ef54fc458c
commit
71cc0ef940
5 changed files with 66 additions and 6 deletions
|
|
@ -378,6 +378,7 @@ WebMDemuxer::ReadMetadata()
|
|||
mInfo.mVideo.mDisplay = displaySize;
|
||||
mInfo.mVideo.mImage = frameSize;
|
||||
mInfo.mVideo.SetImageRect(pictureRect);
|
||||
mInfo.mVideo.SetAlpha(params.alpha_mode);
|
||||
|
||||
switch (params.stereo_mode) {
|
||||
case NESTEGG_VIDEO_MONO:
|
||||
|
|
@ -656,6 +657,21 @@ WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType, MediaRawDataQueue *aSampl
|
|||
WEBM_DEBUG("nestegg_packet_data failed r=%d", r);
|
||||
return NS_ERROR_DOM_MEDIA_DEMUXER_ERR;
|
||||
}
|
||||
unsigned char* alphaData;
|
||||
size_t alphaLength = 0;
|
||||
// Check packets for alpha information if file has declared alpha frames
|
||||
// may be present.
|
||||
if (mInfo.mVideo.HasAlpha()) {
|
||||
r = nestegg_packet_additional_data(holder->Packet(),
|
||||
1,
|
||||
&alphaData,
|
||||
&alphaLength);
|
||||
if (r == -1) {
|
||||
WEBM_DEBUG(
|
||||
"nestegg_packet_additional_data failed to retrieve alpha data r=%d",
|
||||
r);
|
||||
}
|
||||
}
|
||||
bool isKeyframe = false;
|
||||
if (aType == TrackInfo::kAudioTrack) {
|
||||
isKeyframe = true;
|
||||
|
|
@ -713,10 +729,19 @@ WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType, MediaRawDataQueue *aSampl
|
|||
|
||||
WEBM_DEBUG("push sample tstamp: %ld next_tstamp: %ld length: %ld kf: %d",
|
||||
tstamp, next_tstamp, length, isKeyframe);
|
||||
RefPtr<MediaRawData> sample = new MediaRawData(data, length);
|
||||
if (length && !sample->Data()) {
|
||||
// OOM.
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
RefPtr<MediaRawData> sample;
|
||||
if (mInfo.mVideo.HasAlpha() && alphaLength != 0) {
|
||||
sample = new MediaRawData(data, length, alphaData, alphaLength);
|
||||
if (length && !sample->Data() || (alphaLength && !sample->AlphaData())) {
|
||||
// OOM.
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
} else {
|
||||
sample = new MediaRawData(data, length);
|
||||
if (length && !sample->Data()) {
|
||||
// OOM.
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
sample->mTimecode = tstamp;
|
||||
sample->mTime = tstamp;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue