Integrate PackedAudioWriter
Closes #342. Change-Id: I2fb4a651ad90448ab226b386c92c94e11ff9f9a8
This commit is contained in:
parent
39beb99d6c
commit
0af2c5cdcf
34
README.md
34
README.md
|
@ -16,28 +16,30 @@ Shaka Packager supports:
|
||||||
- [HLS](https://developer.apple.com/streaming/)
|
- [HLS](https://developer.apple.com/streaming/)
|
||||||
- Key systems:
|
- Key systems:
|
||||||
- [Widevine](http://www.widevine.com/)
|
- [Widevine](http://www.widevine.com/)
|
||||||
- [PlayReady](https://www.microsoft.com/playready/)<sup>1</sup>
|
- [PlayReady](https://www.microsoft.com/playready/)¹
|
||||||
- [Fairplay](https://developer.apple.com/streaming/fps/)<sup>1</sup>
|
- [Fairplay](https://developer.apple.com/streaming/fps/)¹
|
||||||
- Encryption standards:
|
- Encryption standards:
|
||||||
- [CENC](https://en.wikipedia.org/wiki/MPEG_Common_Encryption)
|
- [CENC](https://en.wikipedia.org/wiki/MPEG_Common_Encryption)
|
||||||
- [SAMPLE-AES](https://developer.apple.com/library/content/documentation/AudioVideo/Conceptual/HLS_Sample_Encryption/Intro/Intro.html)
|
- [SAMPLE-AES](https://developer.apple.com/library/content/documentation/AudioVideo/Conceptual/HLS_Sample_Encryption/Intro/Intro.html)
|
||||||
- Media Containers and codecs
|
- Media Containers and codecs
|
||||||
|
|
||||||
| Codecs | ISO-BMFF | WebM | MPEG2-TS | WVM |
|
| Codecs | ISO-BMFF | WebM | MPEG2-TS | WVM | Packed Audio²|
|
||||||
|:-----------------:|:------------:|:------------:|:------------:|:-----------:|
|
|:-----------------:|:------------:|:------------:|:------------:|:-----------:|:------------:|
|
||||||
| H264 (AVC) | I / O | - | I / O | I |
|
| H264 (AVC) | I / O | - | I / O | I | - |
|
||||||
| H265 (HEVC) | I / O | - | I | - |
|
| H265 (HEVC) | I / O | - | I | - | - |
|
||||||
| VP8 | I / O | I / O | - | - |
|
| VP8 | I / O | I / O | - | - | - |
|
||||||
| VP9 | I / O | I / O | - | - |
|
| VP9 | I / O | I / O | - | - | - |
|
||||||
| AAC | I / O | - | I / O | I |
|
| AAC | I / O | - | I / O | I | O |
|
||||||
| Dolby AC3/EAC3 | I / O | - | I | - |
|
| Dolby AC3/EAC3 | I / O | - | I | - | O |
|
||||||
| DTS | I / O | - | - | - |
|
| DTS | I / O | - | - | - | - |
|
||||||
| FLAC | I / O | - | - | - |
|
| FLAC | I / O | - | - | - | - |
|
||||||
| Opus | *I / O* | I / O | - | - |
|
| Opus | I / O³ | I / O | - | - | - |
|
||||||
| Vorbis | - | I / O | - | - |
|
| Vorbis | - | I / O | - | - | - |
|
||||||
|
|
||||||
** I for input and O for output.
|
NOTES:
|
||||||
** Opus support in ISO-BMFF is experimental.
|
- I for input and O for output.
|
||||||
|
- ²: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-3.4
|
||||||
|
- ³: Opus support in ISO-BMFF is experimental.
|
||||||
- Subtitles
|
- Subtitles
|
||||||
- WebVTT in both text form and embedded in MP4
|
- WebVTT in both text form and embedded in MP4
|
||||||
- TTML in text form (DASH only)
|
- TTML in text form (DASH only)
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "packager/media/base/muxer_options.h"
|
#include "packager/media/base/muxer_options.h"
|
||||||
#include "packager/media/formats/mp2t/ts_muxer.h"
|
#include "packager/media/formats/mp2t/ts_muxer.h"
|
||||||
#include "packager/media/formats/mp4/mp4_muxer.h"
|
#include "packager/media/formats/mp4/mp4_muxer.h"
|
||||||
|
#include "packager/media/formats/packed_audio/packed_audio_writer.h"
|
||||||
#include "packager/media/formats/webm/webm_muxer.h"
|
#include "packager/media/formats/webm/webm_muxer.h"
|
||||||
#include "packager/packager.h"
|
#include "packager/packager.h"
|
||||||
|
|
||||||
|
@ -34,6 +35,11 @@ std::shared_ptr<Muxer> MuxerFactory::CreateMuxer(
|
||||||
std::shared_ptr<Muxer> muxer;
|
std::shared_ptr<Muxer> muxer;
|
||||||
|
|
||||||
switch (output_format) {
|
switch (output_format) {
|
||||||
|
case CONTAINER_AAC:
|
||||||
|
case CONTAINER_AC3:
|
||||||
|
case CONTAINER_EAC3:
|
||||||
|
muxer = std::make_shared<PackedAudioWriter>(options);
|
||||||
|
break;
|
||||||
case CONTAINER_WEBM:
|
case CONTAINER_WEBM:
|
||||||
muxer = std::make_shared<webm::WebMMuxer>(options);
|
muxer = std::make_shared<webm::WebMMuxer>(options);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1726,7 +1726,15 @@ MediaContainerName DetermineContainer(const uint8_t* buffer, int buffer_size) {
|
||||||
|
|
||||||
MediaContainerName DetermineContainerFromFormatName(
|
MediaContainerName DetermineContainerFromFormatName(
|
||||||
const std::string& format_name) {
|
const std::string& format_name) {
|
||||||
if (base::EqualsCaseInsensitiveASCII(format_name, "webm")) {
|
if (base::EqualsCaseInsensitiveASCII(format_name, "aac") ||
|
||||||
|
base::EqualsCaseInsensitiveASCII(format_name, "adts")) {
|
||||||
|
return CONTAINER_AAC;
|
||||||
|
} else if (base::EqualsCaseInsensitiveASCII(format_name, "ac3")) {
|
||||||
|
return CONTAINER_AC3;
|
||||||
|
} else if (base::EqualsCaseInsensitiveASCII(format_name, "ec3") ||
|
||||||
|
base::EqualsCaseInsensitiveASCII(format_name, "eac3")) {
|
||||||
|
return CONTAINER_EAC3;
|
||||||
|
} else if (base::EqualsCaseInsensitiveASCII(format_name, "webm")) {
|
||||||
return CONTAINER_WEBM;
|
return CONTAINER_WEBM;
|
||||||
} else if (base::EqualsCaseInsensitiveASCII(format_name, "m4a") ||
|
} else if (base::EqualsCaseInsensitiveASCII(format_name, "m4a") ||
|
||||||
base::EqualsCaseInsensitiveASCII(format_name, "m4v") ||
|
base::EqualsCaseInsensitiveASCII(format_name, "m4v") ||
|
||||||
|
|
|
@ -46,6 +46,9 @@ void SetMediaInfoContainerType(MuxerListener::ContainerType container_type,
|
||||||
case MuxerListener::kContainerMpeg2ts:
|
case MuxerListener::kContainerMpeg2ts:
|
||||||
media_info->set_container_type(MediaInfo::CONTAINER_MPEG2_TS);
|
media_info->set_container_type(MediaInfo::CONTAINER_MPEG2_TS);
|
||||||
break;
|
break;
|
||||||
|
case MuxerListener::kContainerPackedAudio:
|
||||||
|
media_info->set_container_type(MediaInfo::CONTAINER_PACKED_AUDIO);
|
||||||
|
break;
|
||||||
case MuxerListener::kContainerWebM:
|
case MuxerListener::kContainerWebM:
|
||||||
media_info->set_container_type(MediaInfo::CONTAINER_WEBM);
|
media_info->set_container_type(MediaInfo::CONTAINER_WEBM);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -17,6 +17,7 @@ message MediaInfo {
|
||||||
CONTAINER_MPEG2_TS= 2;
|
CONTAINER_MPEG2_TS= 2;
|
||||||
CONTAINER_WEBM = 3;
|
CONTAINER_WEBM = 3;
|
||||||
CONTAINER_TEXT = 4;
|
CONTAINER_TEXT = 4;
|
||||||
|
CONTAINER_PACKED_AUDIO = 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
message VideoInfo {
|
message VideoInfo {
|
||||||
|
|
|
@ -218,15 +218,17 @@ Status ValidateStreamDescriptor(bool dump_stream_info,
|
||||||
"All TS segments must be self-initializing. Stream "
|
"All TS segments must be self-initializing. Stream "
|
||||||
"descriptors 'output' or 'init_segment' are not allowed.");
|
"descriptors 'output' or 'init_segment' are not allowed.");
|
||||||
}
|
}
|
||||||
} else if (output_format == CONTAINER_WEBVTT) {
|
} else if (output_format == CONTAINER_WEBVTT ||
|
||||||
// There is no need for an init segment when outputting to WebVTT because
|
output_format == CONTAINER_AAC || output_format == CONTAINER_AC3 ||
|
||||||
// there is no initialization data.
|
output_format == CONTAINER_EAC3) {
|
||||||
|
// There is no need for an init segment when outputting because there is no
|
||||||
|
// initialization data.
|
||||||
if (stream.segment_template.length() && stream.output.length()) {
|
if (stream.segment_template.length() && stream.output.length()) {
|
||||||
return Status(
|
return Status(
|
||||||
error::INVALID_ARGUMENT,
|
error::INVALID_ARGUMENT,
|
||||||
"Segmented WebVTT output cannot have an init segment. Do not specify "
|
"Segmented WebVTT or PackedAudio output cannot have an init segment. "
|
||||||
"stream descriptors 'output' or 'init_segment' when using "
|
"Do not specify stream descriptors 'output' or 'init_segment' when "
|
||||||
"'segment_template' with WebVtt.");
|
"using 'segment_template'.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// For any other format, if there is a segment template, there must be an
|
// For any other format, if there is a segment template, there must be an
|
||||||
|
@ -386,8 +388,11 @@ std::shared_ptr<MediaHandler> CreateEncryptionHandler(
|
||||||
// Use Sample AES in MPEG2TS.
|
// Use Sample AES in MPEG2TS.
|
||||||
// TODO(kqyang): Consider adding a new flag to enable Sample AES as we
|
// TODO(kqyang): Consider adding a new flag to enable Sample AES as we
|
||||||
// will support CENC in TS in the future.
|
// will support CENC in TS in the future.
|
||||||
if (GetOutputFormat(stream) == CONTAINER_MPEG2TS) {
|
if (GetOutputFormat(stream) == CONTAINER_MPEG2TS ||
|
||||||
VLOG(1) << "Use Apple Sample AES encryption for MPEG2TS.";
|
GetOutputFormat(stream) == CONTAINER_AAC ||
|
||||||
|
GetOutputFormat(stream) == CONTAINER_AC3 ||
|
||||||
|
GetOutputFormat(stream) == CONTAINER_EAC3) {
|
||||||
|
VLOG(1) << "Use Apple Sample AES encryption for MPEG2TS or Packed Audio.";
|
||||||
encryption_params.protection_scheme = kAppleSampleAesProtectionScheme;
|
encryption_params.protection_scheme = kAppleSampleAesProtectionScheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
'media/event/media_event.gyp:media_event',
|
'media/event/media_event.gyp:media_event',
|
||||||
'media/formats/mp2t/mp2t.gyp:mp2t',
|
'media/formats/mp2t/mp2t.gyp:mp2t',
|
||||||
'media/formats/mp4/mp4.gyp:mp4',
|
'media/formats/mp4/mp4.gyp:mp4',
|
||||||
|
'media/formats/packed_audio/packed_audio.gyp:packed_audio',
|
||||||
'media/formats/webm/webm.gyp:webm',
|
'media/formats/webm/webm.gyp:webm',
|
||||||
'media/formats/webvtt/webvtt.gyp:webvtt',
|
'media/formats/webvtt/webvtt.gyp:webvtt',
|
||||||
'media/formats/wvm/wvm.gyp:wvm',
|
'media/formats/wvm/wvm.gyp:wvm',
|
||||||
|
|
Loading…
Reference in New Issue