• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ANDROID_MEDIA_TRACK_TRANSCODER_CALLBACK_H
18 #define ANDROID_MEDIA_TRACK_TRANSCODER_CALLBACK_H
19 
20 #include <media/NdkMediaError.h>
21 
22 namespace android {
23 
24 class MediaTrackTranscoder;
25 
26 /** Callback interface for MediaTrackTranscoder. */
27 class MediaTrackTranscoderCallback {
28 public:
29     /**
30      * Called when the MediaTrackTranscoder's actual track format becomes available.
31      * @param transcoder The MediaTrackTranscoder whose track format becomes available.
32      */
33     virtual void onTrackFormatAvailable(const MediaTrackTranscoder* transcoder);
34     /**
35      * Called when the MediaTrackTranscoder instance have finished transcoding all media samples
36      * successfully.
37      * @param transcoder The MediaTrackTranscoder that finished the transcoding.
38      */
39     virtual void onTrackFinished(const MediaTrackTranscoder* transcoder);
40 
41     /**
42      * Called when the MediaTrackTranscoder instance was explicitly stopped before it was finished.
43      * @param transcoder The MediaTrackTranscoder that was stopped.
44      */
45     virtual void onTrackStopped(const MediaTrackTranscoder* transcoder);
46 
47     /**
48      * Called when the MediaTrackTranscoder instance encountered an error it could not recover from.
49      * @param transcoder The MediaTrackTranscoder that encountered the error.
50      * @param status The non-zero error code describing the encountered error.
51      */
52     virtual void onTrackError(const MediaTrackTranscoder* transcoder, media_status_t status);
53 
54 protected:
55     virtual ~MediaTrackTranscoderCallback() = default;
56 };
57 
58 }  // namespace android
59 #endif  // ANDROID_MEDIA_TRACK_TRANSCODER_CALLBACK_H
60