File: gmp-audio-decode.h

package info (click to toggle)
thunderbird 1%3A52.8.0-1~deb8u1
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 1,710,120 kB
  • sloc: cpp: 5,081,109; ansic: 2,051,982; python: 458,727; java: 241,615; xml: 193,367; asm: 178,649; sh: 81,881; makefile: 24,703; perl: 16,874; objc: 4,389; yacc: 1,816; ada: 1,697; lex: 1,257; pascal: 1,251; cs: 879; exp: 499; php: 436; lisp: 258; awk: 152; sed: 51; ruby: 47; csh: 27
file content (84 lines) | stat: -rw-r--r-- 2,830 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
/*
* Copyright 2013, Mozilla Foundation and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

#ifndef GMP_AUDIO_DECODE_h_
#define GMP_AUDIO_DECODE_h_

#include "gmp-errors.h"
#include "gmp-audio-samples.h"
#include "gmp-audio-codec.h"
#include <stdint.h>

// ALL METHODS MUST BE CALLED ON THE MAIN THREAD
class GMPAudioDecoderCallback
{
public:
  virtual ~GMPAudioDecoderCallback() {}

  virtual void Decoded(GMPAudioSamples* aDecodedSamples) = 0;

  virtual void InputDataExhausted() = 0;

  virtual void DrainComplete() = 0;

  virtual void ResetComplete() = 0;

  // Called when the decoder encounters a catestrophic error and cannot
  // continue. Gecko will not send any more input for decoding.
  virtual void Error(GMPErr aError) = 0;
};

#define GMP_API_AUDIO_DECODER "decode-audio"

// Audio decoding for a single stream. A GMP may be asked to create multiple
// decoders concurrently.
//
// API name macro: GMP_API_AUDIO_DECODER
// Host API: GMPAudioHost
//
// ALL METHODS MUST BE CALLED ON THE MAIN THREAD
class GMPAudioDecoder
{
public:
  virtual ~GMPAudioDecoder() {}

  // aCallback: Subclass should retain reference to it until DecodingComplete
  //            is called. Do not attempt to delete it, host retains ownership.
  // TODO: Pass AudioHost so decoder can create GMPAudioEncodedFrame objects?
  virtual void InitDecode(const GMPAudioCodec& aCodecSettings,
                          GMPAudioDecoderCallback* aCallback) = 0;

  // Decode encoded audio frames (as a part of an audio stream). The decoded
  // frames must be returned to the user through the decode complete callback.
  virtual void Decode(GMPAudioSamples* aEncodedSamples) = 0;

  // Reset decoder state and prepare for a new call to Decode(...).
  // Flushes the decoder pipeline.
  // The decoder should enqueue a task to run ResetComplete() on the main
  // thread once the reset has finished.
  virtual void Reset() = 0;

  // Output decoded frames for any data in the pipeline, regardless of ordering.
  // All remaining decoded frames should be immediately returned via callback.
  // The decoder should enqueue a task to run DrainComplete() on the main
  // thread once the reset has finished.
  virtual void Drain() = 0;

  // May free decoder memory.
  virtual void DecodingComplete() = 0;
};

#endif // GMP_VIDEO_DECODE_h_