Browse code

swr: doxycomment public API.

Clément Bœsch authored on 2011/11/17 19:20:29
Showing 1 changed files
... ...
@@ -18,6 +18,11 @@
18 18
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 19
  */
20 20
 
21
+/**
22
+ * @file
23
+ * libswresample public header
24
+ */
25
+
21 26
 #ifndef SWR_H
22 27
 #define SWR_H
23 28
 
... ...
@@ -28,9 +33,9 @@
28 28
 #define LIBSWRESAMPLE_VERSION_MINOR 3
29 29
 #define LIBSWRESAMPLE_VERSION_MICRO 0
30 30
 
31
-#define SWR_CH_MAX 16
31
+#define SWR_CH_MAX 16   ///< Maximum number of channels
32 32
 
33
-#define SWR_FLAG_RESAMPLE 1///< Force resampling even if equal sample rate
33
+#define SWR_FLAG_RESAMPLE 1 ///< Force resampling even if equal sample rate
34 34
 //TODO use int resample ?
35 35
 //long term TODO can we enable this dynamically?
36 36
 
... ...
@@ -39,21 +44,43 @@ struct SwrContext;
39 39
 
40 40
 /**
41 41
  * Allocate SwrContext.
42
- * @see swr_init(),swr_free()
43
- * @return NULL on error
42
+ *
43
+ * If you use this function you will need to set the parameters (manually or
44
+ * with swr_alloc_set_opts()) before calling swr_init().
45
+ *
46
+ * @see swr_alloc_set_opts(), swr_init(), swr_free()
47
+ * @return NULL on error, allocated context otherwise
44 48
  */
45 49
 struct SwrContext *swr_alloc(void);
46 50
 
47 51
 /**
48 52
  * Initialize context after user parameters have been set.
49
- * @return negativo n error
53
+ *
54
+ * @return AVERROR error code in case of failure.
50 55
  */
51 56
 int swr_init(struct SwrContext *s);
52 57
 
53 58
 /**
54
- * Allocate SwrContext.
55
- * @see swr_init(),swr_free()
56
- * @return NULL on error
59
+ * Allocate SwrContext if needed and set/reset common parameters.
60
+ *
61
+ * This function does not require s to be allocated with swr_alloc(). On the
62
+ * other hand, swr_alloc() can use swr_alloc_set_opts() to set the parameters
63
+ * on the allocated context.
64
+ *
65
+ * @param s               Swr context, can be NULL
66
+ * @param out_ch_layout   output channel layout (AV_CH_LAYOUT_*)
67
+ * @param out_sample_fmt  output sample format (AV_SAMPLE_FMT_*). Use +0x100 for planar audio
68
+ * @param out_sample_rate output sample rate (frequency in Hz)
69
+ * @param in_ch_layout    input channel layout (AV_CH_LAYOUT_*)
70
+ * @param in_sample_fmt   input sample format (AV_SAMPLE_FMT_*). Use +0x100 for planar audio
71
+ * @param in_sample_rate  input sample rate (frequency in Hz)
72
+ * @param channel_map     customized input channel mapping (array of channel
73
+ *                        indexes, -1 for a muted channel), can be NULL
74
+ * @param log_offset      logging level offset
75
+ * @param log_ctx         parent logging context, can be NULL
76
+ *
77
+ * @see swr_init(), swr_free()
78
+ * @return NULL on error, allocated context otherwise
57 79
  */
58 80
 struct SwrContext *swr_alloc_set_opts(struct SwrContext *s,
59 81
                                       int64_t out_ch_layout, enum AVSampleFormat out_sample_fmt, int out_sample_rate,
... ...
@@ -61,22 +88,30 @@ struct SwrContext *swr_alloc_set_opts(struct SwrContext *s,
61 61
                                       const int *channel_map, int log_offset, void *log_ctx);
62 62
 
63 63
 /**
64
- * Free the given SwrContext.
65
- * And set the pointer to NULL
64
+ * Free the given SwrContext and set the pointer to NULL.
66 65
  */
67 66
 void swr_free(struct SwrContext **s);
68 67
 
69 68
 /**
70 69
  * Convert audio.
71 70
  *
72
- * in & in_count can be set to 0 to flush the last few samples out at the end.
73
- * @param  in_count Number of input samples available in one channel.
74
- * @param out_count Amount of space available for output in samples per channel.
71
+ * in and in_count can be set to 0 to flush the last few samples out at the
72
+ * end.
73
+ *
74
+ * @param s         allocated Swr context, with parameters set
75
+ * @param out       output buffers, only the first one need be set in case of packed audio
76
+ * @param out_count amount of space available for output in samples per channel
77
+ * @param in        input buffers, only the first one need to be set in case of packed audio
78
+ * @param in_count  number of input samples available in one channel
79
+ *
75 80
  * @return number of samples output per channel
76 81
  */
77 82
 int swr_convert(struct SwrContext *s, uint8_t *out[SWR_CH_MAX], int out_count,
78 83
                                 const uint8_t *in [SWR_CH_MAX], int in_count);
79 84
 
85
+/**
86
+ * Activate resampling compensation.
87
+ */
80 88
 void swr_compensate(struct SwrContext *s, int sample_delta, int compensation_distance);
81 89
 
82 90
 #endif