OSDN Git Service

Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 19 Feb 2012 23:47:46 +0000 (00:47 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 20 Feb 2012 00:29:30 +0000 (01:29 +0100)
* qatar/master:
  doxy: remove reference to removed api
  examples: unbreak compilation
  ttadec: cosmetics: reindent
  sunrast: use RLE trigger macro inplace of the hard coded value.
  sunrastenc: set keyframe flag for the output packet.
  mpegvideo_enc: switch to encode2().
  mpegvideo_enc: force encoding delay of at least 1 frame when low_delay=0

Conflicts:
doc/examples/muxing.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
15 files changed:
1  2 
doc/examples/decoding_encoding.c
doc/examples/muxing.c
libavcodec/flvenc.c
libavcodec/h261enc.c
libavcodec/mjpegenc.c
libavcodec/mpeg12enc.c
libavcodec/mpeg4videoenc.c
libavcodec/mpegvideo.h
libavcodec/mpegvideo_enc.c
libavcodec/rv10enc.c
libavcodec/rv20enc.c
libavcodec/sunrast.c
libavcodec/tta.c
libavcodec/wmv2enc.c
libavformat/avformat.h

@@@ -67,10 -72,9 +67,10 @@@ static void audio_encode_example(const 
      c->bit_rate = 64000;
      c->sample_rate = 44100;
      c->channels = 2;
 +    c->sample_fmt = AV_SAMPLE_FMT_S16;
  
      /* open it */
-     if (avcodec_open(c, codec) < 0) {
+     if (avcodec_open2(c, codec, NULL) < 0) {
          fprintf(stderr, "could not open codec\n");
          exit(1);
      }
@@@ -239,11 -241,8 +239,11 @@@ static void video_encode_example(const 
      c->max_b_frames=1;
      c->pix_fmt = PIX_FMT_YUV420P;
  
 +    if(codec_id == CODEC_ID_H264)
 +        av_opt_set(c->priv_data, "preset", "slow", 0);
 +
      /* open it */
-     if (avcodec_open(c, codec) < 0) {
+     if (avcodec_open2(c, codec, NULL) < 0) {
          fprintf(stderr, "could not open codec\n");
          exit(1);
      }
Simple merge
Simple merge
Simple merge
@@@ -450,28 -445,6 +450,27 @@@ void ff_mjpeg_encode_mb(MpegEncContext 
      s->i_tex_bits += get_bits_diff(s);
  }
  
- static int amv_encode_picture(AVCodecContext *avctx,
-                        unsigned char *buf, int buf_size, void *data)
- {
 +// maximum over s->mjpeg_vsample[i]
 +#define V_MAX 2
-     AVFrame* pic=data;
++static int amv_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
++                              AVFrame *pic, int *got_packet)
 +
-     return ff_MPV_encode_picture(avctx,buf, buf_size, pic);
++{
 +    MpegEncContext *s = avctx->priv_data;
 +    int i;
 +
 +    //CODEC_FLAG_EMU_EDGE have to be cleared
 +    if(s->avctx->flags & CODEC_FLAG_EMU_EDGE)
 +        return -1;
 +
 +    //picture should be flipped upside-down
 +    for(i=0; i < 3; i++) {
 +        pic->data[i] += (pic->linesize[i] * (s->mjpeg_vsample[i] * (8 * s->mb_height -((s->height/V_MAX)&7)) - 1 ));
 +        pic->linesize[i] *= -1;
 +    }
++    return ff_MPV_encode_picture(avctx, pkt, pic, got_packet);
 +}
 +
  AVCodec ff_mjpeg_encoder = {
      .name           = "mjpeg",
      .type           = AVMEDIA_TYPE_VIDEO,
      .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_NONE},
      .long_name= NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"),
  };
-     .encode         = amv_encode_picture,
 +
 +AVCodec ff_amv_encoder = {
 +    .name           = "amv",
 +    .type           = AVMEDIA_TYPE_VIDEO,
 +    .id             = CODEC_ID_AMV,
 +    .priv_data_size = sizeof(MpegEncContext),
 +    .init           = ff_MPV_encode_init,
++    .encode2        = amv_encode_picture,
 +    .close          = ff_MPV_encode_end,
 +    .pix_fmts= (const enum PixelFormat[]){PIX_FMT_YUVJ420P, PIX_FMT_YUVJ422P, PIX_FMT_NONE},
 +    .long_name      = NULL_IF_CONFIG_SMALL("AMV Video"),
 +};
Simple merge
Simple merge
Simple merge
@@@ -1384,14 -1377,17 +1388,17 @@@ no_output_pic
      return 0;
  }
  
- int ff_MPV_encode_picture(AVCodecContext *avctx,
-                           unsigned char *buf, int buf_size, void *data)
+ int ff_MPV_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
+                           const AVFrame *pic_arg, int *got_packet)
  {
      MpegEncContext *s = avctx->priv_data;
-     AVFrame *pic_arg  = data;
-     int i, stuffing_count;
+     int i, stuffing_count, ret;
      int context_count = s->slice_context_count;
  
 -        (ret = ff_alloc_packet(pkt, s->mb_width*s->mb_height*MAX_MB_BYTES)) < 0)
+     if (!pkt->data &&
++        (ret = ff_alloc_packet(pkt, s->mb_width*s->mb_height*(MAX_MB_BYTES+100)+10000)) < 0)
+         return ret;
      for (i = 0; i < context_count; i++) {
          int start_y = s->thread_context[i]->start_mb_y;
          int   end_y = s->thread_context[i]->  end_mb_y;
@@@ -2385,7 -2389,7 +2406,7 @@@ static int encode_thread(AVCodecContex
              if(s->data_partitioning){
                  if(   s->pb2   .buf_end - s->pb2   .buf - (put_bits_count(&s->    pb2)>>3) < MAX_MB_BYTES
                     || s->tex_pb.buf_end - s->tex_pb.buf - (put_bits_count(&s->tex_pb )>>3) < MAX_MB_BYTES){
--                    av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
++                    av_log(s->avctx, AV_LOG_ERROR, "encoded partitioned frame too large\n");
                      return -1;
                  }
              }
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge