Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Unified Diff: services/media/framework/util/conversion_pipeline_builder.cc

Issue 2069873003: Motown: Define MediaRenderer and make it the way we identify renderers. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Fix build break...audio_track_controller.* gone for good. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: services/media/framework/util/conversion_pipeline_builder.cc
diff --git a/services/media/framework/util/conversion_pipeline_builder.cc b/services/media/framework/util/conversion_pipeline_builder.cc
index fb784144f3dafbd74d8353f1a1cb0d7895936c6c..e4d3015ef8ac8c193ab4c5a227f7beb772b398b2 100644
--- a/services/media/framework/util/conversion_pipeline_builder.cc
+++ b/services/media/framework/util/conversion_pipeline_builder.cc
@@ -144,6 +144,36 @@ AddResult AddTransformsForCompressedAudio(
return AddResult::kProgressed;
}
+// Attempts to add transforms to the pipeline given an input compressed video
+// stream type with (in_type) and the set of output types we need to convert to
+// (out_type_sets). If the call succeeds, *out_type is set to the new output
+// type. Otherwise, *out_type is set to nullptr.
+AddResult AddTransformsForCompressedVideo(
+ const VideoStreamType& in_type,
+ const std::vector<std::unique_ptr<StreamTypeSet>>& out_type_sets,
+ Graph* graph,
+ OutputRef* output,
+ std::unique_ptr<StreamType>* out_type) {
+ DCHECK(out_type);
+ DCHECK(graph);
+
+ // TODO(dalesat): See if we already have a matching video type.
+
+ // Need to decode. Create a decoder and go from there.
+ std::shared_ptr<Decoder> decoder;
+ Result result = Decoder::Create(in_type, &decoder);
+ if (result != Result::kOk) {
+ // No decoder found.
+ *out_type = nullptr;
+ return AddResult::kFailed;
+ }
+
+ *output = graph->ConnectOutputToPart(*output, graph->Add(decoder)).output();
+ *out_type = decoder->output_stream_type();
+
+ return AddResult::kProgressed;
+}
+
// Attempts to add transforms to the pipeline given an input LPCM stream type
// (in_type) and the output lpcm stream type set for the type we need to
// convert to (out_type_set). If the call succeeds, *out_type is set to the new
@@ -242,6 +272,14 @@ AddResult AddTransforms(
return AddTransformsForCompressedAudio(*in_type.audio(), out_type_sets,
graph, output, out_type);
}
+ case StreamType::Medium::kVideo:
+ if (in_type.encoding() == StreamType::kVideoEncodingUncompressed) {
+ *out_type = in_type.Clone();
+ return AddResult::kFinished;
+ } else {
+ return AddTransformsForCompressedVideo(*in_type.video(), out_type_sets,
+ graph, output, out_type);
+ }
default:
NOTREACHED() << "conversion not supported for medium" << in_type.medium();
*out_type = nullptr;
« no previous file with comments | « services/media/factory_service/media_timeline_controller_impl.cc ('k') | services/media/framework_ffmpeg/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698