#define LIBAVCODEC_VERSION_INT 0x000406
#define LIBAVCODEC_VERSION "0.4.6"
-#define LIBAVCODEC_BUILD 4601
-#define LIBAVCODEC_BUILD_STR "4601"
+#define LIBAVCODEC_BUILD 4602
+#define LIBAVCODEC_BUILD_STR "4602"
enum CodecID {
CODEC_ID_NONE,
int frame_number; /* audio or video frame number */
int key_frame; /* true if the previous compressed frame was
a key frame (intra, or seekable) */
+ int delay; /* number of frames the decoded output will be delayed relative to the encoded input */
+
+ /* encoding parameters */
int quality; /* quality of the previous encoded frame
(between 1 (good) and 31 (bad))
this is allso used to set the quality in vbr mode
{
int vo_ver_id=1; //must be 2 if we want GMC or q-pel
char buf[255];
-
+
+ s->vo_type= s->has_b_frames ? CORE_VO_TYPE : SIMPLE_VO_TYPE;
+
if(get_bit_count(&s->pb)!=0) mpeg4_stuffing(&s->pb);
put_bits(&s->pb, 16, 0);
put_bits(&s->pb, 16, 0x100); /* video obj */
put_bits(&s->pb, 16, 0x120); /* video obj layer */
put_bits(&s->pb, 1, 0); /* random access vol */
- put_bits(&s->pb, 8, 1); /* video obj type indication= simple obj */
+ put_bits(&s->pb, 8, s->vo_type); /* video obj type indication */
put_bits(&s->pb, 1, 1); /* is obj layer id= yes */
put_bits(&s->pb, 4, vo_ver_id); /* is obj layer ver id */
put_bits(&s->pb, 3, 1); /* is obj layer priority */
put_bits(&s->pb, 4, s->aspect_ratio_info);/* aspect ratio info */
else
put_bits(&s->pb, 4, 1); /* aspect ratio info= sqare pixel */
- put_bits(&s->pb, 1, 0); /* vol control parameters= no */
+
+ if(s->low_delay){
+ put_bits(&s->pb, 1, 1); /* vol control parameters= yes */
+ put_bits(&s->pb, 2, 1); /* chroma format 422 */
+ put_bits(&s->pb, 1, s->low_delay);
+ put_bits(&s->pb, 1, 0); /* vbv parameters= no */
+ }else{
+ put_bits(&s->pb, 1, 0); /* vol control parameters= no */
+ }
+
put_bits(&s->pb, 2, RECT_SHAPE); /* vol shape= rectangle */
put_bits(&s->pb, 1, 1); /* marker bit */
/* vol header */
skip_bits(&s->gb, 1); /* random access */
- skip_bits(&s->gb, 8); /* vo_type */
+ s->vo_type= get_bits(&s->gb, 8);
if (get_bits1(&s->gb) != 0) { /* is_ol_id */
vo_ver_id = get_bits(&s->gb, 4); /* vo_ver_id */
skip_bits(&s->gb, 3); /* vo_priority */
}
if(get_bits1(&s->gb)){ /* vol control parameter */
- printf("vol control parameter not supported\n");
- return -1;
+ int chroma_format= get_bits(&s->gb, 2);
+ if(chroma_format!=1){
+ printf("illegal chroma format\n");
+ }
+ s->low_delay= get_bits1(&s->gb);
+ if(get_bits1(&s->gb)){ /* vbv parameters */
+ printf("vbv parameters not supported\n");
+ return -1;
+ }
+ }else{
+ s->low_delay=0;
}
+
s->shape = get_bits(&s->gb, 2); /* vol shape */
if(s->shape != RECT_SHAPE) printf("only rectangular vol supported\n");
if(s->shape == GRAY_SHAPE && vo_ver_id != 1){
switch(avctx->codec->id) {
case CODEC_ID_MPEG1VIDEO:
s->out_format = FMT_MPEG1;
+ avctx->delay=0; //FIXME not sure, should check the spec
break;
case CODEC_ID_MJPEG:
s->out_format = FMT_MJPEG;
s->mjpeg_hsample[2] = 1;
if (mjpeg_init(s) < 0)
return -1;
+ avctx->delay=0;
break;
case CODEC_ID_H263:
if (h263_get_picture_format(s->width, s->height) == 7) {
return -1;
}
s->out_format = FMT_H263;
+ avctx->delay=0;
break;
case CODEC_ID_H263P:
s->out_format = FMT_H263;
/* These are just to be sure */
s->umvplus = 0;
s->umvplus_dec = 0;
+ avctx->delay=0;
break;
case CODEC_ID_RV10:
s->out_format = FMT_H263;
s->h263_rv10 = 1;
+ avctx->delay=0;
break;
case CODEC_ID_MPEG4:
s->out_format = FMT_H263;
s->h263_pred = 1;
s->unrestricted_mv = 1;
s->has_b_frames= s->max_b_frames ? 1 : 0;
+ s->low_delay=0;
+ avctx->delay= s->low_delay ? 0 : (s->max_b_frames + 1);
break;
case CODEC_ID_MSMPEG4V1:
s->out_format = FMT_H263;
s->h263_pred = 1;
s->unrestricted_mv = 1;
s->msmpeg4_version= 1;
+ avctx->delay=0;
break;
case CODEC_ID_MSMPEG4V2:
s->out_format = FMT_H263;
s->h263_pred = 1;
s->unrestricted_mv = 1;
s->msmpeg4_version= 2;
+ avctx->delay=0;
break;
case CODEC_ID_MSMPEG4V3:
s->out_format = FMT_H263;
s->h263_pred = 1;
s->unrestricted_mv = 1;
s->msmpeg4_version= 3;
+ avctx->delay=0;
break;
default:
return -1;