Mercurial > libavcodec.hg
comparison h263.c @ 2572:c22ad129a91b libavcodec
support omiting various headers in mpeg4 as WMP seems to have difficulty with them
based upon 27_WMP_compatibility_with_ISOMPEG4.patch by (Calcium | calcium nurs or jp)
indention fixed
uses workaround_bugs instead of strict_std_compliancy as WMP is not the reference implementation
author | michael |
---|---|
date | Wed, 23 Mar 2005 11:39:38 +0000 |
parents | 84a8f374bf63 |
children | 0d88e3f89379 |
comparison
equal
deleted
inserted
replaced
2571:b17d868a8f39 | 2572:c22ad129a91b |
---|---|
2019 if(s->flags & CODEC_FLAG_GLOBAL_HEADER){ | 2019 if(s->flags & CODEC_FLAG_GLOBAL_HEADER){ |
2020 | 2020 |
2021 s->avctx->extradata= av_malloc(1024); | 2021 s->avctx->extradata= av_malloc(1024); |
2022 init_put_bits(&s->pb, s->avctx->extradata, 1024); | 2022 init_put_bits(&s->pb, s->avctx->extradata, 1024); |
2023 | 2023 |
2024 mpeg4_encode_visual_object_header(s); | 2024 if(!(s->workaround_bugs & FF_BUG_MS)) |
2025 mpeg4_encode_visual_object_header(s); | |
2025 mpeg4_encode_vol_header(s, 0, 0); | 2026 mpeg4_encode_vol_header(s, 0, 0); |
2026 | 2027 |
2027 // ff_mpeg4_stuffing(&s->pb); ? | 2028 // ff_mpeg4_stuffing(&s->pb); ? |
2028 flush_put_bits(&s->pb); | 2029 flush_put_bits(&s->pb); |
2029 s->avctx->extradata_size= (put_bits_count(&s->pb)+7)>>3; | 2030 s->avctx->extradata_size= (put_bits_count(&s->pb)+7)>>3; |
2318 put_bits(&s->pb, 16, 0); | 2319 put_bits(&s->pb, 16, 0); |
2319 put_bits(&s->pb, 16, 0x120 + vol_number); /* video obj layer */ | 2320 put_bits(&s->pb, 16, 0x120 + vol_number); /* video obj layer */ |
2320 | 2321 |
2321 put_bits(&s->pb, 1, 0); /* random access vol */ | 2322 put_bits(&s->pb, 1, 0); /* random access vol */ |
2322 put_bits(&s->pb, 8, s->vo_type); /* video obj type indication */ | 2323 put_bits(&s->pb, 8, s->vo_type); /* video obj type indication */ |
2323 put_bits(&s->pb, 1, 1); /* is obj layer id= yes */ | 2324 if(s->workaround_bugs & FF_BUG_MS) { |
2324 put_bits(&s->pb, 4, vo_ver_id); /* is obj layer ver id */ | 2325 put_bits(&s->pb, 1, 0); /* is obj layer id= no */ |
2325 put_bits(&s->pb, 3, 1); /* is obj layer priority */ | 2326 } else { |
2327 put_bits(&s->pb, 1, 1); /* is obj layer id= yes */ | |
2328 put_bits(&s->pb, 4, vo_ver_id); /* is obj layer ver id */ | |
2329 put_bits(&s->pb, 3, 1); /* is obj layer priority */ | |
2330 } | |
2326 | 2331 |
2327 aspect_to_info(s, s->avctx->sample_aspect_ratio); | 2332 aspect_to_info(s, s->avctx->sample_aspect_ratio); |
2328 | 2333 |
2329 put_bits(&s->pb, 4, s->aspect_ratio_info);/* aspect ratio info */ | 2334 put_bits(&s->pb, 4, s->aspect_ratio_info);/* aspect ratio info */ |
2330 if (s->aspect_ratio_info == FF_ASPECT_EXTENDED){ | 2335 if (s->aspect_ratio_info == FF_ASPECT_EXTENDED){ |
2331 put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.num); | 2336 put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.num); |
2332 put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.den); | 2337 put_bits(&s->pb, 8, s->avctx->sample_aspect_ratio.den); |
2333 } | 2338 } |
2334 | 2339 |
2335 put_bits(&s->pb, 1, 1); /* vol control parameters= yes */ | 2340 if(s->workaround_bugs & FF_BUG_MS) { // |
2336 put_bits(&s->pb, 2, 1); /* chroma format YUV 420/YV12 */ | 2341 put_bits(&s->pb, 1, 0); /* vol control parameters= no @@@ */ |
2337 put_bits(&s->pb, 1, s->low_delay); | 2342 } else { |
2338 put_bits(&s->pb, 1, 0); /* vbv parameters= no */ | 2343 put_bits(&s->pb, 1, 1); /* vol control parameters= yes */ |
2344 put_bits(&s->pb, 2, 1); /* chroma format YUV 420/YV12 */ | |
2345 put_bits(&s->pb, 1, s->low_delay); | |
2346 put_bits(&s->pb, 1, 0); /* vbv parameters= no */ | |
2347 } | |
2339 | 2348 |
2340 put_bits(&s->pb, 2, RECT_SHAPE); /* vol shape= rectangle */ | 2349 put_bits(&s->pb, 2, RECT_SHAPE); /* vol shape= rectangle */ |
2341 put_bits(&s->pb, 1, 1); /* marker bit */ | 2350 put_bits(&s->pb, 1, 1); /* marker bit */ |
2342 | 2351 |
2343 put_bits(&s->pb, 16, s->time_increment_resolution); | 2352 put_bits(&s->pb, 16, s->time_increment_resolution); |
2403 if(s->strict_std_compliance < 2) //HACK, the reference sw is buggy | 2412 if(s->strict_std_compliance < 2) //HACK, the reference sw is buggy |
2404 mpeg4_encode_visual_object_header(s); | 2413 mpeg4_encode_visual_object_header(s); |
2405 if(s->strict_std_compliance < 2 || picture_number==0) //HACK, the reference sw is buggy | 2414 if(s->strict_std_compliance < 2 || picture_number==0) //HACK, the reference sw is buggy |
2406 mpeg4_encode_vol_header(s, 0, 0); | 2415 mpeg4_encode_vol_header(s, 0, 0); |
2407 } | 2416 } |
2408 mpeg4_encode_gop_header(s); | 2417 if(!(s->workaround_bugs & FF_BUG_MS)) |
2418 mpeg4_encode_gop_header(s); | |
2409 } | 2419 } |
2410 | 2420 |
2411 s->partitioned_frame= s->data_partitioning && s->pict_type!=B_TYPE; | 2421 s->partitioned_frame= s->data_partitioning && s->pict_type!=B_TYPE; |
2412 | 2422 |
2413 //printf("num:%d rate:%d base:%d\n", s->picture_number, s->frame_rate, FRAME_RATE_BASE); | 2423 //printf("num:%d rate:%d base:%d\n", s->picture_number, s->frame_rate, FRAME_RATE_BASE); |