]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/apiexample.c
matroskadec: use new metadata API to export some simple information
[ffmpeg] / libavcodec / apiexample.c
index 7fe1c119d40b541bc264ed9f228313d736fa1c27..14fee3bd3a644438d9d4ae46fe4c8db469fb5401 100644 (file)
@@ -1,5 +1,25 @@
+/*
+ * copyright (c) 2001 Fabrice Bellard
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
 /**
- * @file apiexample.c
+ * @file libavcodec/apiexample.c
  * avcodec API use example.
  *
  * Note that this library only handles codecs (mpeg, mpeg4, etc...),
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <math.h>
 
 #ifdef HAVE_AV_CONFIG_H
 #undef HAVE_AV_CONFIG_H
 #endif
 
 #include "avcodec.h"
+#include "libavutil/mathematics.h"
 
 #define INBUF_SIZE 4096
 
@@ -102,9 +122,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) {
@@ -206,8 +223,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);
@@ -319,11 +334,11 @@ void video_decode_example(const char *outfilename, const char *filename)
     picture= avcodec_alloc_frame();
 
     if(codec->capabilities&CODEC_CAP_TRUNCATED)
-        c->flags|= CODEC_FLAG_TRUNCATED; /* we dont send complete frames */
+        c->flags|= CODEC_FLAG_TRUNCATED; /* we do not send complete frames */
 
-    /* for some codecs, such as msmpeg4 and mpeg4, width and height
-       MUST be initialized there because these info are not available
-       in the bitstream */
+    /* For some codecs, such as msmpeg4 and mpeg4, width and height
+       MUST be initialized there because this information is not
+       available in the bitstream. */
 
     /* open it */
     if (avcodec_open(c, codec) < 0) {
@@ -416,8 +431,7 @@ int main(int argc, char **argv)
     /* must be called before using avcodec lib */
     avcodec_init();
 
-    /* register all the codecs (you can also register only the codec
-       you wish to have smaller code */
+    /* register all the codecs */
     avcodec_register_all();
 
     if (argc <= 1) {