From 8e0b9f35fbe058432e5522a2e8181b877b7e2e03 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Mon, 23 Dec 2024 08:18:02 -0800 Subject: [PATCH] feat: expand the set of supported explicit audio encodings (#7960) docs: updated ExplicitDecodingConfig documentation to reflect changes related to newly supported encodings PiperOrigin-RevId: 708316885 Source-Link: https://github.com/googleapis/googleapis/commit/bf2a7ca1d46894df9ebccf5ad6338cbe9e21d9a8 Source-Link: https://github.com/googleapis/googleapis-gen/commit/4989c73469fea28e5181e961a83affff70b843b4 Copy-Tag: eyJwIjoiU3BlZWNoLy5Pd2xCb3QueWFtbCIsImgiOiI0OTg5YzczNDY5ZmVhMjhlNTE4MWU5NjFhODNhZmZmZjcwYjg0M2I0In0= --- Speech/metadata/V2/CloudSpeech.php | Bin 21643 -> 21762 bytes Speech/src/V2/ExplicitDecodingConfig.php | 84 +++++++----------- .../ExplicitDecodingConfig/AudioEncoding.php | 63 +++++++++++++ Speech/src/V2/OutputFormatConfig.php | 40 ++++----- 4 files changed, 117 insertions(+), 70 deletions(-) diff --git a/Speech/metadata/V2/CloudSpeech.php b/Speech/metadata/V2/CloudSpeech.php index feaf1a5b8bc437251435f4c6a9a83505d2d66817..a37c0b0865c3bff8183364c63a90c38c09726a52 100644 GIT binary patch delta 192 zcmeBP$=I}taf1{K)69jNWmuBint32 sample_rate_hertz = 2; + * Generated from protobuf field int32 sample_rate_hertz = 2 [(.google.api.field_behavior) = OPTIONAL]; */ private $sample_rate_hertz = 0; /** - * Number of channels present in the audio data sent for recognition. - * Supported for the following encodings: - * * LINEAR16: Headerless 16-bit signed little-endian PCM samples. - * * MULAW: Headerless 8-bit companded mulaw samples. - * * ALAW: Headerless 8-bit companded alaw samples. + * Optional. Number of channels present in the audio data sent for + * recognition. Note that this field is marked as OPTIONAL for backward + * compatibility reasons. It is (and has always been) effectively REQUIRED. * The maximum allowed value is 8. * - * Generated from protobuf field int32 audio_channel_count = 3; + * Generated from protobuf field int32 audio_channel_count = 3 [(.google.api.field_behavior) = OPTIONAL]; */ private $audio_channel_count = 0; @@ -55,20 +51,16 @@ class ExplicitDecodingConfig extends \Google\Protobuf\Internal\Message * @type int $encoding * Required. Encoding of the audio data sent for recognition. * @type int $sample_rate_hertz - * Sample rate in Hertz of the audio data sent for recognition. Valid - * values are: 8000-48000. 16000 is optimal. For best results, set the + * Optional. Sample rate in Hertz of the audio data sent for recognition. + * Valid values are: 8000-48000. 16000 is optimal. For best results, set the * sampling rate of the audio source to 16000 Hz. If that's not possible, use * the native sample rate of the audio source (instead of re-sampling). - * Supported for the following encodings: - * * LINEAR16: Headerless 16-bit signed little-endian PCM samples. - * * MULAW: Headerless 8-bit companded mulaw samples. - * * ALAW: Headerless 8-bit companded alaw samples. + * Note that this field is marked as OPTIONAL for backward compatibility + * reasons. It is (and has always been) effectively REQUIRED. * @type int $audio_channel_count - * Number of channels present in the audio data sent for recognition. - * Supported for the following encodings: - * * LINEAR16: Headerless 16-bit signed little-endian PCM samples. - * * MULAW: Headerless 8-bit companded mulaw samples. - * * ALAW: Headerless 8-bit companded alaw samples. + * Optional. Number of channels present in the audio data sent for + * recognition. Note that this field is marked as OPTIONAL for backward + * compatibility reasons. It is (and has always been) effectively REQUIRED. * The maximum allowed value is 8. * } */ @@ -104,16 +96,14 @@ public function setEncoding($var) } /** - * Sample rate in Hertz of the audio data sent for recognition. Valid - * values are: 8000-48000. 16000 is optimal. For best results, set the + * Optional. Sample rate in Hertz of the audio data sent for recognition. + * Valid values are: 8000-48000. 16000 is optimal. For best results, set the * sampling rate of the audio source to 16000 Hz. If that's not possible, use * the native sample rate of the audio source (instead of re-sampling). - * Supported for the following encodings: - * * LINEAR16: Headerless 16-bit signed little-endian PCM samples. - * * MULAW: Headerless 8-bit companded mulaw samples. - * * ALAW: Headerless 8-bit companded alaw samples. + * Note that this field is marked as OPTIONAL for backward compatibility + * reasons. It is (and has always been) effectively REQUIRED. * - * Generated from protobuf field int32 sample_rate_hertz = 2; + * Generated from protobuf field int32 sample_rate_hertz = 2 [(.google.api.field_behavior) = OPTIONAL]; * @return int */ public function getSampleRateHertz() @@ -122,16 +112,14 @@ public function getSampleRateHertz() } /** - * Sample rate in Hertz of the audio data sent for recognition. Valid - * values are: 8000-48000. 16000 is optimal. For best results, set the + * Optional. Sample rate in Hertz of the audio data sent for recognition. + * Valid values are: 8000-48000. 16000 is optimal. For best results, set the * sampling rate of the audio source to 16000 Hz. If that's not possible, use * the native sample rate of the audio source (instead of re-sampling). - * Supported for the following encodings: - * * LINEAR16: Headerless 16-bit signed little-endian PCM samples. - * * MULAW: Headerless 8-bit companded mulaw samples. - * * ALAW: Headerless 8-bit companded alaw samples. + * Note that this field is marked as OPTIONAL for backward compatibility + * reasons. It is (and has always been) effectively REQUIRED. * - * Generated from protobuf field int32 sample_rate_hertz = 2; + * Generated from protobuf field int32 sample_rate_hertz = 2 [(.google.api.field_behavior) = OPTIONAL]; * @param int $var * @return $this */ @@ -144,14 +132,12 @@ public function setSampleRateHertz($var) } /** - * Number of channels present in the audio data sent for recognition. - * Supported for the following encodings: - * * LINEAR16: Headerless 16-bit signed little-endian PCM samples. - * * MULAW: Headerless 8-bit companded mulaw samples. - * * ALAW: Headerless 8-bit companded alaw samples. + * Optional. Number of channels present in the audio data sent for + * recognition. Note that this field is marked as OPTIONAL for backward + * compatibility reasons. It is (and has always been) effectively REQUIRED. * The maximum allowed value is 8. * - * Generated from protobuf field int32 audio_channel_count = 3; + * Generated from protobuf field int32 audio_channel_count = 3 [(.google.api.field_behavior) = OPTIONAL]; * @return int */ public function getAudioChannelCount() @@ -160,14 +146,12 @@ public function getAudioChannelCount() } /** - * Number of channels present in the audio data sent for recognition. - * Supported for the following encodings: - * * LINEAR16: Headerless 16-bit signed little-endian PCM samples. - * * MULAW: Headerless 8-bit companded mulaw samples. - * * ALAW: Headerless 8-bit companded alaw samples. + * Optional. Number of channels present in the audio data sent for + * recognition. Note that this field is marked as OPTIONAL for backward + * compatibility reasons. It is (and has always been) effectively REQUIRED. * The maximum allowed value is 8. * - * Generated from protobuf field int32 audio_channel_count = 3; + * Generated from protobuf field int32 audio_channel_count = 3 [(.google.api.field_behavior) = OPTIONAL]; * @param int $var * @return $this */ diff --git a/Speech/src/V2/ExplicitDecodingConfig/AudioEncoding.php b/Speech/src/V2/ExplicitDecodingConfig/AudioEncoding.php index f2e449525006..d4d99cfe4b9b 100644 --- a/Speech/src/V2/ExplicitDecodingConfig/AudioEncoding.php +++ b/Speech/src/V2/ExplicitDecodingConfig/AudioEncoding.php @@ -37,12 +37,75 @@ class AudioEncoding * Generated from protobuf enum ALAW = 3; */ const ALAW = 3; + /** + * AMR frames with an rfc4867.5 header. + * + * Generated from protobuf enum AMR = 4; + */ + const AMR = 4; + /** + * AMR-WB frames with an rfc4867.5 header. + * + * Generated from protobuf enum AMR_WB = 5; + */ + const AMR_WB = 5; + /** + * FLAC frames in the "native FLAC" container format. + * + * Generated from protobuf enum FLAC = 6; + */ + const FLAC = 6; + /** + * MPEG audio frames with optional (ignored) ID3 metadata. + * + * Generated from protobuf enum MP3 = 7; + */ + const MP3 = 7; + /** + * Opus audio frames in an Ogg container. + * + * Generated from protobuf enum OGG_OPUS = 8; + */ + const OGG_OPUS = 8; + /** + * Opus audio frames in a WebM container. + * + * Generated from protobuf enum WEBM_OPUS = 9; + */ + const WEBM_OPUS = 9; + /** + * AAC audio frames in an MP4 container. + * + * Generated from protobuf enum MP4_AAC = 10; + */ + const MP4_AAC = 10; + /** + * AAC audio frames in an M4A container. + * + * Generated from protobuf enum M4A_AAC = 11; + */ + const M4A_AAC = 11; + /** + * AAC audio frames in an MOV container. + * + * Generated from protobuf enum MOV_AAC = 12; + */ + const MOV_AAC = 12; private static $valueToName = [ self::AUDIO_ENCODING_UNSPECIFIED => 'AUDIO_ENCODING_UNSPECIFIED', self::LINEAR16 => 'LINEAR16', self::MULAW => 'MULAW', self::ALAW => 'ALAW', + self::AMR => 'AMR', + self::AMR_WB => 'AMR_WB', + self::FLAC => 'FLAC', + self::MP3 => 'MP3', + self::OGG_OPUS => 'OGG_OPUS', + self::WEBM_OPUS => 'WEBM_OPUS', + self::MP4_AAC => 'MP4_AAC', + self::M4A_AAC => 'M4A_AAC', + self::MOV_AAC => 'MOV_AAC', ]; public static function name($value) diff --git a/Speech/src/V2/OutputFormatConfig.php b/Speech/src/V2/OutputFormatConfig.php index 2b2934e90a7c..15b88dad418d 100644 --- a/Speech/src/V2/OutputFormatConfig.php +++ b/Speech/src/V2/OutputFormatConfig.php @@ -17,22 +17,22 @@ class OutputFormatConfig extends \Google\Protobuf\Internal\Message { /** * Configuration for the native output format. If this field is set or if no - * other output format field is set then transcripts will be written to the + * other output format field is set, then transcripts will be written to the * sink in the native format. * * Generated from protobuf field .google.cloud.speech.v2.NativeOutputFileFormatConfig native = 1; */ private $native = null; /** - * Configuration for the vtt output format. If this field is set then - * transcripts will be written to the sink in the vtt format. + * Configuration for the VTT output format. If this field is set, then + * transcripts will be written to the sink in the VTT format. * * Generated from protobuf field .google.cloud.speech.v2.VttOutputFileFormatConfig vtt = 2; */ private $vtt = null; /** - * Configuration for the srt output format. If this field is set then - * transcripts will be written to the sink in the srt format. + * Configuration for the SRT output format. If this field is set, then + * transcripts will be written to the sink in the SRT format. * * Generated from protobuf field .google.cloud.speech.v2.SrtOutputFileFormatConfig srt = 3; */ @@ -46,14 +46,14 @@ class OutputFormatConfig extends \Google\Protobuf\Internal\Message * * @type \Google\Cloud\Speech\V2\NativeOutputFileFormatConfig $native * Configuration for the native output format. If this field is set or if no - * other output format field is set then transcripts will be written to the + * other output format field is set, then transcripts will be written to the * sink in the native format. * @type \Google\Cloud\Speech\V2\VttOutputFileFormatConfig $vtt - * Configuration for the vtt output format. If this field is set then - * transcripts will be written to the sink in the vtt format. + * Configuration for the VTT output format. If this field is set, then + * transcripts will be written to the sink in the VTT format. * @type \Google\Cloud\Speech\V2\SrtOutputFileFormatConfig $srt - * Configuration for the srt output format. If this field is set then - * transcripts will be written to the sink in the srt format. + * Configuration for the SRT output format. If this field is set, then + * transcripts will be written to the sink in the SRT format. * } */ public function __construct($data = NULL) { @@ -63,7 +63,7 @@ public function __construct($data = NULL) { /** * Configuration for the native output format. If this field is set or if no - * other output format field is set then transcripts will be written to the + * other output format field is set, then transcripts will be written to the * sink in the native format. * * Generated from protobuf field .google.cloud.speech.v2.NativeOutputFileFormatConfig native = 1; @@ -86,7 +86,7 @@ public function clearNative() /** * Configuration for the native output format. If this field is set or if no - * other output format field is set then transcripts will be written to the + * other output format field is set, then transcripts will be written to the * sink in the native format. * * Generated from protobuf field .google.cloud.speech.v2.NativeOutputFileFormatConfig native = 1; @@ -102,8 +102,8 @@ public function setNative($var) } /** - * Configuration for the vtt output format. If this field is set then - * transcripts will be written to the sink in the vtt format. + * Configuration for the VTT output format. If this field is set, then + * transcripts will be written to the sink in the VTT format. * * Generated from protobuf field .google.cloud.speech.v2.VttOutputFileFormatConfig vtt = 2; * @return \Google\Cloud\Speech\V2\VttOutputFileFormatConfig|null @@ -124,8 +124,8 @@ public function clearVtt() } /** - * Configuration for the vtt output format. If this field is set then - * transcripts will be written to the sink in the vtt format. + * Configuration for the VTT output format. If this field is set, then + * transcripts will be written to the sink in the VTT format. * * Generated from protobuf field .google.cloud.speech.v2.VttOutputFileFormatConfig vtt = 2; * @param \Google\Cloud\Speech\V2\VttOutputFileFormatConfig $var @@ -140,8 +140,8 @@ public function setVtt($var) } /** - * Configuration for the srt output format. If this field is set then - * transcripts will be written to the sink in the srt format. + * Configuration for the SRT output format. If this field is set, then + * transcripts will be written to the sink in the SRT format. * * Generated from protobuf field .google.cloud.speech.v2.SrtOutputFileFormatConfig srt = 3; * @return \Google\Cloud\Speech\V2\SrtOutputFileFormatConfig|null @@ -162,8 +162,8 @@ public function clearSrt() } /** - * Configuration for the srt output format. If this field is set then - * transcripts will be written to the sink in the srt format. + * Configuration for the SRT output format. If this field is set, then + * transcripts will be written to the sink in the SRT format. * * Generated from protobuf field .google.cloud.speech.v2.SrtOutputFileFormatConfig srt = 3; * @param \Google\Cloud\Speech\V2\SrtOutputFileFormatConfig $var