diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-05-15 19:18:02 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-05-15 19:18:02 +0200 |
commit | d46aada5c2c71b9b0a259e62699cab25837053b2 (patch) | |
tree | ab474244a6fda04d8a10d25201620cdaee11c3c6 /libavcodec/utils.c | |
parent | 66b1f210c024a08ba00e4a730e64940d248b8717 (diff) | |
parent | 5a153604c930792aa7f00c55cbf3c470f582dfb7 (diff) | |
download | ffmpeg-d46aada5c2c71b9b0a259e62699cab25837053b2.tar.gz |
Merge branch 'master' into oldabi
* master: (403 commits)
Initial caf muxer.
Support decoding of amr_nb and gsm in caf.
Fix decoding of msrle samples with 1bpp.
udp: remove resource.h inclusion, it breaks mingw compilation.
ffmpeg: Allow seting and cycling through debug modes.
Fix FSF address copy paste error in some license headers.
Add an aac sample which uses LTP to fate-aac.
ffmpeg: Help for interactive keys.
UDP: dont use thread_t as truth value.
swscale: fix compile on mingw32
[PATCH] Update pixdesc_be fate refs after adding 9/10bit YUV420P formats.
arm: properly mark external symbol call
ffmpeg: Interactivity support. Try pressing +-hs.
swscale: 10l forgot git add this change from ronald.
AVFrame: only set parameters from AVCodecContext in decode_video*() when no frame reordering is used.
avcodec_default_get_buffer: init picture parameters.
swscale: properly inline bits/endianness in yuv2yuvX16inC().
swscale: fix clipping of 9/10bit YUV420P.
Add av_clip_uintp2() function
Support more QT 1bpp rawvideo files.
...
Conflicts:
libavcodec/flacenc.c
libavcodec/h261dec.c
libavcodec/h263dec.c
libavcodec/mpeg12.c
libavcodec/msrle.c
libavcodec/options.c
libavcodec/qpeg.c
libavcodec/rv34.c
libavcodec/svq1dec.c
libavcodec/svq3.c
libavcodec/vc1dec.c
libavcodec/version.h
libavfilter/avfilter.h
libavformat/file.c
libavformat/options.c
libavformat/rtpproto.c
libavformat/udp.c
libavutil/avutil.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 39 |
1 files changed, 32 insertions, 7 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index a350605f97..0c03c5224d 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -147,6 +147,8 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int l case PIX_FMT_YUV420P9BE: case PIX_FMT_YUV420P10LE: case PIX_FMT_YUV420P10BE: + case PIX_FMT_YUV422P10LE: + case PIX_FMT_YUV422P10BE: w_align= 16; //FIXME check for non mpeg style codecs and use less alignment h_align= 16; if(s->codec_id == CODEC_ID_MPEG2VIDEO || s->codec_id == CODEC_ID_MJPEG || s->codec_id == CODEC_ID_AMV || s->codec_id == CODEC_ID_THP || s->codec_id == CODEC_ID_H264) @@ -354,9 +356,18 @@ int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ } s->internal_buffer_count++; - if(s->pkt) pic->pkt_pts= s->pkt->pts; - else pic->pkt_pts= AV_NOPTS_VALUE; + if (s->pkt) { + pic->pkt_pts = s->pkt->pts; + pic->pkt_pos = s->pkt->pos; + } else { + pic->pkt_pts = AV_NOPTS_VALUE; + pic->pkt_pos = -1; + } pic->reordered_opaque= s->reordered_opaque; + pic->sample_aspect_ratio = s->sample_aspect_ratio; + pic->width = s->width; + pic->height = s->height; + pic->format = s->pix_fmt; if(s->debug&FF_DEBUG_BUFFERS) av_log(s, AV_LOG_DEBUG, "default_get_buffer called on pic %p, %d buffers used\n", pic, s->internal_buffer_count); @@ -461,7 +472,10 @@ void avcodec_get_frame_defaults(AVFrame *pic){ memset(pic, 0, sizeof(AVFrame)); pic->pts = pic->best_effort_timestamp = AV_NOPTS_VALUE; + pic->pkt_pos = -1; pic->key_frame= 1; + pic->sample_aspect_ratio = (AVRational){0, 1}; + pic->format = -1; /* unknown */ } AVFrame *avcodec_alloc_frame(void){ @@ -684,8 +698,7 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, av_log(avctx, AV_LOG_ERROR, "start_display_time must be 0.\n"); return -1; } - if(sub->num_rects == 0 || !sub->rects) - return -1; + ret = avctx->codec->encode(avctx, buf, buf_size, sub); avctx->frame_number++; return ret; @@ -743,6 +756,18 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi ret = avctx->codec->decode(avctx, picture, got_picture_ptr, avpkt); picture->pkt_dts= avpkt->dts; + + if(!avctx->has_b_frames){ + picture->pkt_pos= avpkt->pos; + if (!picture->sample_aspect_ratio.num) + picture->sample_aspect_ratio = avctx->sample_aspect_ratio; + if (!picture->width) + picture->width = avctx->width; + if (!picture->height) + picture->height = avctx->height; + if (picture->format == PIX_FMT_NONE) + picture->format = avctx->pix_fmt; + } } emms_c(); //needed to avoid an emms_c() call before every return; @@ -1334,9 +1359,9 @@ int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)) unsigned int ff_toupper4(unsigned int x) { return toupper( x &0xFF) - + (toupper((x>>8 )&0xFF)<<8 ) - + (toupper((x>>16)&0xFF)<<16) - + (toupper((x>>24)&0xFF)<<24); + + (toupper((x>>8 )&0xFF)<<8 ) + + (toupper((x>>16)&0xFF)<<16) + + (toupper((x>>24)&0xFF)<<24); } #if !HAVE_PTHREADS |