summaryrefslogtreecommitdiff
path: root/contrib/ffmpeg/libavcodec/apiexample.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ffmpeg/libavcodec/apiexample.c')
-rw-r--r--contrib/ffmpeg/libavcodec/apiexample.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/contrib/ffmpeg/libavcodec/apiexample.c b/contrib/ffmpeg/libavcodec/apiexample.c
index 484c77876..151637bd2 100644
--- a/contrib/ffmpeg/libavcodec/apiexample.c
+++ b/contrib/ffmpeg/libavcodec/apiexample.c
@@ -32,6 +32,8 @@
#include <string.h>
#include <math.h>
+#define PI 3.14159265358979323846
+
#ifdef HAVE_AV_CONFIG_H
#undef HAVE_AV_CONFIG_H
#endif
@@ -89,7 +91,7 @@ void audio_encode_example(const char *filename)
/* encode a single tone sound */
t = 0;
- tincr = 2 * M_PI * 440.0 / c->sample_rate;
+ tincr = 2 * PI * 440.0 / c->sample_rate;
for(i=0;i<200;i++) {
for(j=0;j<frame_size;j++) {
samples[2*j] = (int)(sin(t) * 10000);
@@ -122,9 +124,6 @@ void audio_decode_example(const char *outfilename, const char *filename)
printf("Audio decoding\n");
- /* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */
- memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE);
-
/* find the mpeg audio decoder */
codec = avcodec_find_decoder(CODEC_ID_MP2);
if (!codec) {
@@ -226,8 +225,6 @@ void video_encode_example(const char *filename)
exit(1);
}
- /* the codec gives us the frame size, in samples */
-
f = fopen(filename, "wb");
if (!f) {
fprintf(stderr, "could not open %s\n", filename);