Mercurial > libavcodec.hg
comparison parser.c @ 2837:45ccf6842c34 libavcodec
parse pict_type for streams in avi
fix mpeg4 parser so it outputs te pict_type
support header only parseing without repacking
| author | michael |
|---|---|
| date | Mon, 15 Aug 2005 15:58:21 +0000 |
| parents | 09108466b7d0 |
| children | 40765c51a7a9 |
comparison
equal
deleted
inserted
replaced
| 2836:7bfea1374957 | 2837:45ccf6842c34 |
|---|---|
| 427 const uint8_t *buf, int buf_size) | 427 const uint8_t *buf, int buf_size) |
| 428 { | 428 { |
| 429 ParseContext1 *pc1 = s->priv_data; | 429 ParseContext1 *pc1 = s->priv_data; |
| 430 ParseContext *pc= &pc1->pc; | 430 ParseContext *pc= &pc1->pc; |
| 431 int next; | 431 int next; |
| 432 | 432 |
| 433 next= ff_mpeg1_find_frame_end(pc, buf, buf_size); | 433 if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){ |
| 434 | 434 next= buf_size; |
| 435 if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) { | 435 }else{ |
| 436 *poutbuf = NULL; | 436 next= ff_mpeg1_find_frame_end(pc, buf, buf_size); |
| 437 *poutbuf_size = 0; | 437 |
| 438 return buf_size; | 438 if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) { |
| 439 *poutbuf = NULL; | |
| 440 *poutbuf_size = 0; | |
| 441 return buf_size; | |
| 442 } | |
| 443 | |
| 439 } | 444 } |
| 440 /* we have a full frame : we just parse the first few MPEG headers | 445 /* we have a full frame : we just parse the first few MPEG headers |
| 441 to have the full timing information. The time take by this | 446 to have the full timing information. The time take by this |
| 442 function should be negligible for uncorrupted streams */ | 447 function should be negligible for uncorrupted streams */ |
| 443 mpegvideo_extract_headers(s, avctx, buf, buf_size); | 448 mpegvideo_extract_headers(s, avctx, buf, buf_size); |
| 504 init_get_bits(gb, buf, 8 * buf_size); | 509 init_get_bits(gb, buf, 8 * buf_size); |
| 505 ret = ff_mpeg4_decode_picture_header(s, gb); | 510 ret = ff_mpeg4_decode_picture_header(s, gb); |
| 506 if (s->width) { | 511 if (s->width) { |
| 507 avcodec_set_dimensions(avctx, s->width, s->height); | 512 avcodec_set_dimensions(avctx, s->width, s->height); |
| 508 } | 513 } |
| 514 s1->pict_type= s->pict_type; | |
| 509 pc->first_picture = 0; | 515 pc->first_picture = 0; |
| 510 return ret; | 516 return ret; |
| 511 } | 517 } |
| 512 | 518 |
| 513 static int mpeg4video_parse_init(AVCodecParserContext *s) | 519 static int mpeg4video_parse_init(AVCodecParserContext *s) |
| 527 const uint8_t *buf, int buf_size) | 533 const uint8_t *buf, int buf_size) |
| 528 { | 534 { |
| 529 ParseContext *pc = s->priv_data; | 535 ParseContext *pc = s->priv_data; |
| 530 int next; | 536 int next; |
| 531 | 537 |
| 532 next= ff_mpeg4_find_frame_end(pc, buf, buf_size); | 538 if(s->flags & PARSER_FLAG_COMPLETE_FRAMES){ |
| 533 | 539 next= buf_size; |
| 534 if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) { | 540 }else{ |
| 535 *poutbuf = NULL; | 541 next= ff_mpeg4_find_frame_end(pc, buf, buf_size); |
| 536 *poutbuf_size = 0; | 542 |
| 537 return buf_size; | 543 if (ff_combine_frame(pc, next, (uint8_t **)&buf, &buf_size) < 0) { |
| 544 *poutbuf = NULL; | |
| 545 *poutbuf_size = 0; | |
| 546 return buf_size; | |
| 547 } | |
| 538 } | 548 } |
| 539 av_mpeg4_decode_header(s, avctx, buf, buf_size); | 549 av_mpeg4_decode_header(s, avctx, buf, buf_size); |
| 540 | 550 |
| 541 *poutbuf = (uint8_t *)buf; | 551 *poutbuf = (uint8_t *)buf; |
| 542 *poutbuf_size = buf_size; | 552 *poutbuf_size = buf_size; |
