]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/libtheoraenc.c
matroskadec: store an AVStream pointer instead of a stream index
[ffmpeg] / libavcodec / libtheoraenc.c
index 3fc70cf3841e16b4c6634365b225c4c09d720b2c..d7f635ca794c8a9b4900b792061c3655bb16d215 100644 (file)
@@ -15,7 +15,7 @@
  *
  * 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 St, Fifth Floor, Boston, MA  02110-1301  USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
 /*!
@@ -31,8 +31,8 @@
  */
 
 /* FFmpeg includes */
+#include "libavutil/log.h"
 #include "avcodec.h"
-#include "log.h"
 
 /* libtheora includes */
 #include <theora/theora.h>
@@ -69,8 +69,8 @@ static int concatenate_packet(unsigned int* offset, AVCodecContext* avc_context,
 
     avc_context->extradata = newdata;
     avc_context->extradata_size = newsize;
-    avc_context->extradata[ (*offset)++ ] = packet->bytes >> 8;
-    avc_context->extradata[ (*offset)++ ] = packet->bytes & 0xff;
+    AV_WB16(avc_context->extradata + (*offset), packet->bytes);
+    *offset += 2;
     memcpy( avc_context->extradata + (*offset), packet->packet, packet->bytes );
     (*offset) += packet->bytes;
     return 0;
@@ -92,6 +92,8 @@ static int encode_init(AVCodecContext* avc_context)
     t_info.frame_height = avc_context->height;
     t_info.offset_x = 0;
     t_info.offset_y = 0;
+    /* Swap numerator and denominator as time_base in AVCodecContext gives the
+     * time period between frames, but theora_info needs the framerate.  */
     t_info.fps_numerator = avc_context->time_base.den;
     t_info.fps_denominator = avc_context->time_base.num;
     if (avc_context->sample_aspect_ratio.num != 0) {
@@ -262,7 +264,7 @@ static int encode_close(AVCodecContext* avc_context)
     return -1;
 }
 
-static const enum PixelFormat supported_pixel_formats[] = { PIX_FMT_YUV420P, -1 };
+static const enum PixelFormat supported_pixel_formats[] = { PIX_FMT_YUV420P, PIX_FMT_NONE };
 
 /*! AVCodec struct exposed to libavcodec */
 AVCodec libtheora_encoder =
@@ -275,4 +277,5 @@ AVCodec libtheora_encoder =
     .close = encode_close,
     .encode = encode_frame,
     .pix_fmts = supported_pixel_formats,
+    .long_name = NULL_IF_CONFIG_SMALL("libtheora Theora"),
 };