if (pkt->dts != AV_NOPTS_VALUE)
pts = (double)pkt->dts / AV_TIME_BASE;
- if (is->video_st->codec.codec_id == CODEC_ID_RAWVIDEO) {
- avpicture_fill((AVPicture *)frame, pkt->data,
- is->video_st->codec.pix_fmt,
- is->video_st->codec.width,
- is->video_st->codec.height);
- frame->pict_type = FF_I_TYPE;
- if (output_picture2(is, frame, pts) < 0)
- goto the_end;
- } else {
len1 = avcodec_decode_video(&is->video_st->codec,
frame, &got_picture,
pkt->data, pkt->size);
if (output_picture2(is, frame, pts) < 0)
goto the_end;
}
- }
av_free_packet(pkt);
if (step)
if (cur_stream)
return 0;
}
+static void flip(AVCodecContext *avctx, AVPicture * picture){
+ if(!avctx->codec_tag && avctx->bits_per_sample && picture->linesize[1]==0){
+ picture->data[0] += picture->linesize[0] * (avctx->height-1);
+ picture->linesize[0] *= -1;
+ }
+}
+
static int raw_decode(AVCodecContext *avctx,
void *data, int *data_size,
uint8_t *buf, int buf_size)
/* Early out without copy if packet size == frame size */
if (buf_size == context->length && context->p == context->buffer) {
avpicture_fill(picture, buf, avctx->pix_fmt, avctx->width, avctx->height);
+ flip(avctx, picture);
*data_size = sizeof(AVPicture);
return buf_size;
}
memcpy(context->p, buf, bytesNeeded);
context->p = context->buffer;
avpicture_fill(picture, context->buffer, avctx->pix_fmt, avctx->width, avctx->height);
+ flip(avctx, picture);
*data_size = sizeof(AVPicture);
return bytesNeeded;
}