165fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko/*
265fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko * Copyright (C) 2015 The Android Open Source Project
365fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko *
465fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko * Licensed under the Apache License, Version 2.0 (the "License");
565fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko * you may not use this file except in compliance with the License.
665fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko * You may obtain a copy of the License at
765fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko *
865fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko *      http://www.apache.org/licenses/LICENSE-2.0
965fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko *
1065fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko * Unless required by applicable law or agreed to in writing, software
1165fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko * distributed under the License is distributed on an "AS IS" BASIS,
1265fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1365fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko * See the License for the specific language governing permissions and
1465fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko * limitations under the License.
1565fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko */
1665fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko
1765fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalkopackage com.android.tv.tuner.source;
1865fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko
1965fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalkoimport com.android.tv.tuner.ChannelScanFileParser;
2065fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalkoimport com.android.tv.tuner.data.TunerChannel;
2165fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko
2265fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko/**
2365fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko * Interface definition for a stream generator. The interface will provide streams
2465fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko * for scanning channels and/or playback.
2565fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko */
2665fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalkopublic interface TsStreamer {
2765fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko    /**
2865fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko     * Starts streaming the data for channel scanning process.
2965fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko     *
3065fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko     * @param channel {@link ChannelScanFileParser.ScanChannel} to be scanned
3165fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko     * @return {@code true} if ready to stream, otherwise {@code false}
3265fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko     */
3365fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko    boolean startStream(ChannelScanFileParser.ScanChannel channel);
3465fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko
3565fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko    /**
3665fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko     * Starts streaming the data for channel playing or recording.
3765fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko     *
3865fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko     * @param channel {@link TunerChannel} to tune
3965fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko     * @return {@code true} if ready to stream, otherwise {@code false}
4065fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko     */
4165fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko    boolean startStream(TunerChannel channel);
4265fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko
4365fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko    /**
4465fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko     * Stops streaming the data.
4565fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko     */
4665fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko    void stopStream();
4765fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko
4865fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko    /**
49d41f0075a7d2ea826204e81fcec57d0aa57171a9Nick Chalko     * Creates {@link TsDataSource} which will provide MPEG-2 TS stream for
5065fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko     * {@link android.media.MediaExtractor}. The source will start from the position
5165fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko     * where it is created.
5265fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko     *
53d41f0075a7d2ea826204e81fcec57d0aa57171a9Nick Chalko     * @return {@link TsDataSource}
5465fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko     */
55d41f0075a7d2ea826204e81fcec57d0aa57171a9Nick Chalko    TsDataSource createDataSource();
5665fda1eaa94968bb55d5ded10dcb0b3f37fb05f2Nick Chalko}
57