Support 'iframe_playlist_name' stream descriptor
Issue: #287 Change-Id: I484761dfacadce05175d16c4c12454f0ed932579
This commit is contained in:
parent
e98a150d62
commit
570a2d1a15
|
@ -17,3 +17,10 @@ HLS specific stream descriptor fields
|
||||||
relative to hls_master_playlist_output (see below). If unspecified,
|
relative to hls_master_playlist_output (see below). If unspecified,
|
||||||
defaults to something of the form 'stream_0.m3u8', 'stream_1.m3u8',
|
defaults to something of the form 'stream_0.m3u8', 'stream_1.m3u8',
|
||||||
'stream_2.m3u8', etc.
|
'stream_2.m3u8', etc.
|
||||||
|
|
||||||
|
:iframe_playlist_name:
|
||||||
|
|
||||||
|
The optional HLS I-Frames only playlist file to create. Usually ends with
|
||||||
|
'.m3u8', and is relative to hls_master_playlist_output (see below). Should
|
||||||
|
only be set for video streams. If unspecified, no I-Frames only playlist is
|
||||||
|
created.
|
||||||
|
|
|
@ -100,7 +100,11 @@ const char kUsage[] =
|
||||||
" - playlist_name: The HLS playlist file to create. Usually ends with\n"
|
" - playlist_name: The HLS playlist file to create. Usually ends with\n"
|
||||||
" '.m3u8', and is relative to --hls_master_playlist_output. If\n"
|
" '.m3u8', and is relative to --hls_master_playlist_output. If\n"
|
||||||
" unspecified, defaults to something of the form 'stream_0.m3u8',\n"
|
" unspecified, defaults to something of the form 'stream_0.m3u8',\n"
|
||||||
" 'stream_1.m3u8', 'stream_2.m3u8', etc.\n";
|
" 'stream_1.m3u8', 'stream_2.m3u8', etc.\n"
|
||||||
|
" - iframe_playlist_name: The optional HLS I-Frames only playlist file\n"
|
||||||
|
" to create. Usually ends with '.m3u8', and is relative to\n"
|
||||||
|
" hls_master_playlist_output. Should only be set for video streams. If\n"
|
||||||
|
" unspecified, no I-Frames only playlist is created.\n";
|
||||||
|
|
||||||
// Labels for parameters in RawKey key info.
|
// Labels for parameters in RawKey key info.
|
||||||
const char kDrmLabelLabel[] = "label";
|
const char kDrmLabelLabel[] = "label";
|
||||||
|
|
|
@ -26,6 +26,7 @@ enum FieldType {
|
||||||
kHlsNameField,
|
kHlsNameField,
|
||||||
kHlsGroupIdField,
|
kHlsGroupIdField,
|
||||||
kHlsPlaylistNameField,
|
kHlsPlaylistNameField,
|
||||||
|
kHlsIframePlaylistNameField,
|
||||||
kTrickPlayFactorField,
|
kTrickPlayFactorField,
|
||||||
kSkipEncryptionField,
|
kSkipEncryptionField,
|
||||||
kDrmStreamLabelField,
|
kDrmStreamLabelField,
|
||||||
|
@ -56,6 +57,7 @@ const FieldNameToTypeMapping kFieldNameTypeMappings[] = {
|
||||||
{"hls_name", kHlsNameField},
|
{"hls_name", kHlsNameField},
|
||||||
{"hls_group_id", kHlsGroupIdField},
|
{"hls_group_id", kHlsGroupIdField},
|
||||||
{"playlist_name", kHlsPlaylistNameField},
|
{"playlist_name", kHlsPlaylistNameField},
|
||||||
|
{"iframe_playlist_name", kHlsIframePlaylistNameField},
|
||||||
{"trick_play_factor", kTrickPlayFactorField},
|
{"trick_play_factor", kTrickPlayFactorField},
|
||||||
{"tpf", kTrickPlayFactorField},
|
{"tpf", kTrickPlayFactorField},
|
||||||
{"skip_encryption", kSkipEncryptionField},
|
{"skip_encryption", kSkipEncryptionField},
|
||||||
|
@ -128,6 +130,10 @@ base::Optional<StreamDescriptor> ParseStreamDescriptor(
|
||||||
descriptor.hls_playlist_name = iter->second;
|
descriptor.hls_playlist_name = iter->second;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case kHlsIframePlaylistNameField: {
|
||||||
|
descriptor.hls_iframe_playlist_name = iter->second;
|
||||||
|
break;
|
||||||
|
}
|
||||||
case kTrickPlayFactorField: {
|
case kTrickPlayFactorField: {
|
||||||
unsigned factor;
|
unsigned factor;
|
||||||
if (!base::StringToUint(iter->second, &factor)) {
|
if (!base::StringToUint(iter->second, &factor)) {
|
||||||
|
|
|
@ -37,7 +37,7 @@ std::unique_ptr<MuxerListener> CreateMpdListenerInternal(
|
||||||
return listener;
|
return listener;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::unique_ptr<MuxerListener> CreateHlsListenerInternal(
|
std::list<std::unique_ptr<MuxerListener>> CreateHlsListenersInternal(
|
||||||
const MuxerListenerFactory::StreamData& stream,
|
const MuxerListenerFactory::StreamData& stream,
|
||||||
int stream_index,
|
int stream_index,
|
||||||
hls::HlsNotifier* notifier) {
|
hls::HlsNotifier* notifier) {
|
||||||
|
@ -47,6 +47,7 @@ std::unique_ptr<MuxerListener> CreateHlsListenerInternal(
|
||||||
std::string group_id = stream.hls_group_id;
|
std::string group_id = stream.hls_group_id;
|
||||||
std::string name = stream.hls_name;
|
std::string name = stream.hls_name;
|
||||||
std::string hls_playlist_name = stream.hls_playlist_name;
|
std::string hls_playlist_name = stream.hls_playlist_name;
|
||||||
|
std::string hls_iframe_playlist_name = stream.hls_iframe_playlist_name;
|
||||||
|
|
||||||
if (name.empty()) {
|
if (name.empty()) {
|
||||||
name = base::StringPrintf("stream_%d", stream_index);
|
name = base::StringPrintf("stream_%d", stream_index);
|
||||||
|
@ -57,9 +58,14 @@ std::unique_ptr<MuxerListener> CreateHlsListenerInternal(
|
||||||
}
|
}
|
||||||
|
|
||||||
const bool kIFramesOnly = true;
|
const bool kIFramesOnly = true;
|
||||||
std::unique_ptr<MuxerListener> listener(new HlsNotifyMuxerListener(
|
std::list<std::unique_ptr<MuxerListener>> listeners;
|
||||||
|
listeners.emplace_back(new HlsNotifyMuxerListener(
|
||||||
hls_playlist_name, !kIFramesOnly, name, group_id, notifier));
|
hls_playlist_name, !kIFramesOnly, name, group_id, notifier));
|
||||||
return listener;
|
if (!hls_iframe_playlist_name.empty()) {
|
||||||
|
listeners.emplace_back(new HlsNotifyMuxerListener(
|
||||||
|
hls_iframe_playlist_name, kIFramesOnly, name, group_id, notifier));
|
||||||
|
}
|
||||||
|
return listeners;
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
@ -85,8 +91,10 @@ std::unique_ptr<MuxerListener> MuxerListenerFactory::CreateListener(
|
||||||
combined_listener->AddListener(CreateMpdListenerInternal(mpd_notifier_));
|
combined_listener->AddListener(CreateMpdListenerInternal(mpd_notifier_));
|
||||||
}
|
}
|
||||||
if (hls_notifier_) {
|
if (hls_notifier_) {
|
||||||
combined_listener->AddListener(
|
for (auto& listener :
|
||||||
CreateHlsListenerInternal(stream, stream_index, hls_notifier_));
|
CreateHlsListenersInternal(stream, stream_index, hls_notifier_)) {
|
||||||
|
combined_listener->AddListener(std::move(listener));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::move(combined_listener);
|
return std::move(combined_listener);
|
||||||
|
@ -99,7 +107,8 @@ std::unique_ptr<MuxerListener> MuxerListenerFactory::CreateHlsListener(
|
||||||
}
|
}
|
||||||
|
|
||||||
const int stream_index = stream_index_++;
|
const int stream_index = stream_index_++;
|
||||||
return CreateHlsListenerInternal(stream, stream_index, hls_notifier_);
|
return std::move(
|
||||||
|
CreateHlsListenersInternal(stream, stream_index, hls_notifier_).front());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace media
|
} // namespace media
|
||||||
|
|
|
@ -43,6 +43,7 @@ class MuxerListenerFactory {
|
||||||
std::string hls_group_id;
|
std::string hls_group_id;
|
||||||
std::string hls_name;
|
std::string hls_name;
|
||||||
std::string hls_playlist_name;
|
std::string hls_playlist_name;
|
||||||
|
std::string hls_iframe_playlist_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Create a new muxer listener.
|
/// Create a new muxer listener.
|
||||||
|
|
|
@ -112,6 +112,9 @@ struct StreamDescriptor {
|
||||||
/// Required for HLS output. It defines the name of the playlist for the
|
/// Required for HLS output. It defines the name of the playlist for the
|
||||||
/// stream. Usually ends with `.m3u8`.
|
/// stream. Usually ends with `.m3u8`.
|
||||||
std::string hls_playlist_name;
|
std::string hls_playlist_name;
|
||||||
|
/// Optional for HLS output. It defines the name of the I-Frames only playlist
|
||||||
|
/// for the stream. For Video only. Usually ends with `.m3u8`.
|
||||||
|
std::string hls_iframe_playlist_name;
|
||||||
};
|
};
|
||||||
|
|
||||||
class SHAKA_EXPORT Packager {
|
class SHAKA_EXPORT Packager {
|
||||||
|
|
Loading…
Reference in New Issue