summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authorkonablend <[email protected]>2012-09-10 17:39:20 +0000
committerkonablend <[email protected]>2012-09-10 17:39:20 +0000
commit438f63486268526dea56410a5e5a31f04b0bdaa2 (patch)
tree72ab2d45a853a395b709906995685c15f4e4a946 /libhb
parent0f39e0706350385b4260a58fa9273e716d61d663 (diff)
Remove contrib/ffmpeg/A02-png-sequences.patch.
Set AVPacket flags indicating key-frame for avcodec_decode_video2() call. Specifically, libav documentation states: * @param[in] avpkt The input AVpacket containing the input buffer. * You can create such packet with av_init_packet() and by then setting * data and size, some decoders might in addition need other fields like * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least * fields possible. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@4950 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/decavcodec.c23
-rw-r--r--libhb/stream.c8
2 files changed, 24 insertions, 7 deletions
diff --git a/libhb/decavcodec.c b/libhb/decavcodec.c
index 783342a44..a71c462b9 100644
--- a/libhb/decavcodec.c
+++ b/libhb/decavcodec.c
@@ -686,7 +686,7 @@ static void checkCadence( int * cadence, uint16_t flags, int64_t start )
* until enough packets have been decoded so that the timestamps can be
* correctly rewritten, if this is necessary.
*/
-static int decodeFrame( hb_work_object_t *w, uint8_t *data, int size, int sequence, int64_t pts, int64_t dts )
+static int decodeFrame( hb_work_object_t *w, uint8_t *data, int size, int sequence, int64_t pts, int64_t dts, uint8_t frametype )
{
hb_work_private_t *pv = w->private_data;
int got_picture, oldlevel = 0;
@@ -696,7 +696,7 @@ static int decodeFrame( hb_work_object_t *w, uint8_t *data, int size, int sequen
if ( global_verbosity_level <= 1 )
{
oldlevel = av_log_get_level();
- av_log_set_level( AV_LOG_QUIET );
+ av_log_set_level( AV_LOG_VERBOSE );
}
av_init_packet( &avp );
@@ -704,6 +704,15 @@ static int decodeFrame( hb_work_object_t *w, uint8_t *data, int size, int sequen
avp.size = size;
avp.pts = pts;
avp.dts = dts;
+ /*
+ * libav avcodec_decode_video2() needs AVPacket flagged with AV_PKT_FLAG_KEY
+ * for some codecs. For example, sequence of PNG in a mov container.
+ */
+ if ( frametype & HB_FRAME_KEY )
+ {
+ avp.flags |= AV_PKT_FLAG_KEY;
+ }
+
if ( avcodec_decode_video2( pv->context, &frame, &got_picture, &avp ) < 0 )
{
++pv->decode_errors;
@@ -870,7 +879,7 @@ static int decodeFrame( hb_work_object_t *w, uint8_t *data, int size, int sequen
return got_picture;
}
-static void decodeVideo( hb_work_object_t *w, uint8_t *data, int size, int sequence, int64_t pts, int64_t dts )
+static void decodeVideo( hb_work_object_t *w, uint8_t *data, int size, int sequence, int64_t pts, int64_t dts, uint8_t frametype )
{
hb_work_private_t *pv = w->private_data;
@@ -903,14 +912,14 @@ static void decodeVideo( hb_work_object_t *w, uint8_t *data, int size, int seque
if ( pout_len > 0 )
{
- decodeFrame( w, pout, pout_len, sequence, parser_pts, parser_dts );
+ decodeFrame( w, pout, pout_len, sequence, parser_pts, parser_dts, frametype );
}
} while ( pos < size );
/* the stuff above flushed the parser, now flush the decoder */
if ( size <= 0 )
{
- while ( decodeFrame( w, NULL, 0, sequence, AV_NOPTS_VALUE, AV_NOPTS_VALUE ) )
+ while ( decodeFrame( w, NULL, 0, sequence, AV_NOPTS_VALUE, AV_NOPTS_VALUE, 0 ) )
{
}
flushDelayQueue( pv );
@@ -1115,7 +1124,7 @@ static int decavcodecvWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
{
if ( pv->context->codec != NULL )
{
- decodeVideo( w, in->data, in->size, in->sequence, pts, dts );
+ decodeVideo( w, in->data, in->size, in->sequence, pts, dts, in->s.frametype );
}
hb_list_add( pv->list, in );
*buf_out = link_buf_list( pv );
@@ -1163,7 +1172,7 @@ static int decavcodecvWork( hb_work_object_t * w, hb_buffer_t ** buf_in,
pv->new_chap = in->s.new_chap;
pv->chap_time = pts >= 0? pts : pv->pts_next;
}
- decodeVideo( w, in->data, in->size, in->sequence, pts, dts );
+ decodeVideo( w, in->data, in->size, in->sequence, pts, dts, in->s.frametype );
hb_buffer_close( &in );
*buf_out = link_buf_list( pv );
return HB_WORK_OK;
diff --git a/libhb/stream.c b/libhb/stream.c
index 27e753f0f..4dd4a4e2a 100644
--- a/libhb/stream.c
+++ b/libhb/stream.c
@@ -5712,6 +5712,14 @@ hb_buffer_t * hb_ffmpeg_read( hb_stream_t *stream )
{
case AVMEDIA_TYPE_VIDEO:
buf->s.type = VIDEO_BUF;
+ /*
+ * libav avcodec_decode_video2() needs AVPacket flagged with AV_PKT_FLAG_KEY
+ * for some codecs. For example, sequence of PNG in a mov container.
+ */
+ if ( stream->ffmpeg_pkt->flags & AV_PKT_FLAG_KEY )
+ {
+ buf->s.frametype |= HB_FRAME_KEY;
+ }
break;
case AVMEDIA_TYPE_AUDIO: