summaryrefslogtreecommitdiffstats
path: root/libhb/encavcodec.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2012-07-11 20:10:20 +0000
committerjstebbins <[email protected]>2012-07-11 20:10:20 +0000
commit8b91bcb733913afea795cfea6178372eee5b4abe (patch)
tree09b4bd5693f2c361861d803522d2340b6beab985 /libhb/encavcodec.c
parent7f1f338df87f6075e7edf0cd598523acaf0f82a1 (diff)
bump libav to libav-v0.8-2197-g1a068bf
Resolves several deprecated api's Eliminates several libav patches Eliminates our builtin downmix in favour of avresample Eliminate HB_INPUT_CH_LAYOUT_* and replace with AV_CH_LAYOUT_* Resolves 6.x and 7.0 input channel layout issues HB had Adds downmix support to declpcm. We never had it! git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4825 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/encavcodec.c')
-rw-r--r--libhb/encavcodec.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/libhb/encavcodec.c b/libhb/encavcodec.c
index 037a7aef2..44453477f 100644
--- a/libhb/encavcodec.c
+++ b/libhb/encavcodec.c
@@ -451,17 +451,25 @@ int encavcodecWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
if ( pv->context->codec )
{
+ int ret;
+ AVPacket pkt;
+ int got_packet;
+
+ av_init_packet(&pkt);
/* Should be way too large */
buf = hb_video_buffer_init( job->width, job->height );
- buf->size = avcodec_encode_video( pv->context, buf->data, buf->alloc,
- frame );
- if ( buf->size <= 0 )
+ pkt.data = buf->data;
+ pkt.size = buf->alloc;
+
+ ret = avcodec_encode_video2( pv->context, &pkt, frame, &got_packet );
+ if ( ret < 0 || pkt.size <= 0 || !got_packet )
{
hb_buffer_close( &buf );
}
else
{
- int64_t frameno = pv->context->coded_frame->pts;
+ int64_t frameno = pkt.pts;
+ buf->size = pkt.size;
buf->s.start = get_frame_start( pv, frameno );
buf->s.stop = get_frame_stop( pv, frameno );
buf->s.flags &= ~HB_FRAME_REF;
@@ -492,7 +500,7 @@ int encavcodecWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
case AV_PICTURE_TYPE_I:
{
buf->s.flags |= HB_FRAME_REF;
- if ( pv->context->coded_frame->key_frame )
+ if ( pkt.flags & AV_PKT_FLAG_KEY )
{
buf->s.frametype = HB_FRAME_IDR;
}
@@ -504,7 +512,7 @@ int encavcodecWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
default:
{
- if ( pv->context->coded_frame->key_frame )
+ if ( pkt.flags & AV_PKT_FLAG_KEY )
{
buf->s.flags |= HB_FRAME_REF;
buf->s.frametype = HB_FRAME_KEY;