libgroove  5.0.0
encoder.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2013 Andrew Kelley
3  *
4  * This file is part of libgroove, which is MIT licensed.
5  * See http://opensource.org/licenses/MIT
6  */
7 
8 #ifndef GROOVE_ENCODER_H
9 #define GROOVE_ENCODER_H
10 
11 #include <groove/groove.h>
12 
15 struct GrooveEncoder {
22 
28  int bit_rate;
29 
33  const char *format_short_name;
37  const char *codec_short_name;
40  const char *filename;
43  const char *mime_type;
44 
48 
52 
59  double gain;
60 
63 
68 };
69 
70 GROOVE_EXPORT struct GrooveEncoder *groove_encoder_create(void);
72 GROOVE_EXPORT void groove_encoder_destroy(struct GrooveEncoder *encoder);
73 
77 GROOVE_EXPORT int groove_encoder_attach(struct GrooveEncoder *encoder,
78  struct GroovePlaylist *playlist);
79 GROOVE_EXPORT int groove_encoder_detach(struct GrooveEncoder *encoder);
80 
85 GROOVE_EXPORT int groove_encoder_buffer_get(struct GrooveEncoder *encoder,
86  struct GrooveBuffer **buffer, int block);
87 
90 GROOVE_EXPORT int groove_encoder_buffer_peek(struct GrooveEncoder *encoder, int block);
91 
93 GROOVE_EXPORT struct GrooveTag *groove_encoder_metadata_get(struct GrooveEncoder *encoder,
94  const char *key, const struct GrooveTag *prev, int flags);
95 
97 GROOVE_EXPORT int groove_encoder_metadata_set(struct GrooveEncoder *encoder, const char *key,
98  const char *value, int flags);
99 
104 GROOVE_EXPORT void groove_encoder_position(struct GrooveEncoder *encoder,
105  struct GroovePlaylistItem **item, double *seconds);
106 
110 GROOVE_EXPORT int groove_encoder_set_gain(struct GrooveEncoder *encoder, double gain);
111 
112 #endif
int groove_encoder_metadata_set(struct GrooveEncoder *encoder, const char *key, const char *value, int flags)
see docs for groove_file_metadata_set
Definition: groove.h:104
int groove_encoder_buffer_get(struct GrooveEncoder *encoder, struct GrooveBuffer **buffer, int block)
returns < 0 on error, GROOVE_BUFFER_NO on aborted (block=1) or no buffer ready (block=0), GROOVE_BUFFER_YES on buffer returned, and GROOVE_BUFFER_END on end of playlist.
const char * mime_type
optional - provide a mime type string to help libgroove guess which format/codec to use ...
Definition: encoder.h:43
void groove_encoder_position(struct GrooveEncoder *encoder, struct GroovePlaylistItem **item, double *seconds)
get the position of the encode head both the current playlist item and the position in seconds in the...
struct GrooveTag * groove_encoder_metadata_get(struct GrooveEncoder *encoder, const char *key, const struct GrooveTag *prev, int flags)
see docs for groove_file_metadata_get
attach a GrooveEncoder to a playlist to keep a buffer of encoded audio full.
Definition: encoder.h:15
struct GrooveAudioFormat actual_audio_format
read-only.
Definition: encoder.h:67
int bit_rate
Select encoding quality by choosing a target bit rate in bits per second.
Definition: encoder.h:28
int encoded_buffer_size
how big the encoded audio buffer should be, in bytes groove_encoder_create defaults this to 16384 ...
Definition: encoder.h:51
double gain
This volume adjustment to make to this player.
Definition: encoder.h:59
struct GrooveEncoder * groove_encoder_create(void)
int groove_encoder_detach(struct GrooveEncoder *encoder)
struct GroovePlaylist * playlist
read-only. set when attached and cleared when detached
Definition: encoder.h:62
const char * filename
optional - provide an example filename to help libgroove guess which format/codec to use ...
Definition: encoder.h:40
const char * format_short_name
optional - choose a short name for the format to help libgroove guess which format to use use avconv ...
Definition: encoder.h:33
Definition: groove.h:118
struct GrooveAudioFormat target_audio_format
The desired audio format to encode.
Definition: encoder.h:21
const char * codec_short_name
optional - choose a short name for the codec to help libgroove guess which codec to use use avconv -c...
Definition: encoder.h:37
void groove_encoder_destroy(struct GrooveEncoder *encoder)
detach before destroying
Definition: groove.h:160
Definition: groove.h:144
int groove_encoder_buffer_peek(struct GrooveEncoder *encoder, int block)
returns < 0 on error, 0 on no buffer ready, 1 on buffer ready if block is 1, block until buffer is re...
int groove_encoder_set_gain(struct GrooveEncoder *encoder, double gain)
See the gain property of GrooveSink.
int groove_encoder_attach(struct GrooveEncoder *encoder, struct GroovePlaylist *playlist)
once you attach, you must detach before destroying the playlist at playlist begin, format headers are generated.
int sink_buffer_size
how big the sink buffer should be, in sample frames.
Definition: encoder.h:47