comparison gxfenc.c @ 1262:8da1b141e83a libavformat

set correct first gop closed value
author bcoudurier
date Mon, 21 Aug 2006 15:49:08 +0000
parents e03e8ce942e8
children 95f56c7b24eb
comparison
equal deleted inserted replaced
1261:e03e8ce942e8 1262:8da1b141e83a
179 ctx->b_per_gop = 9; /* ensure value won't take more than one char */ 179 ctx->b_per_gop = 9; /* ensure value won't take more than one char */
180 } 180 }
181 size = snprintf(buffer, 1024, "Ver 1\nBr %.6f\nIpg 1\nPpi %d\nBpiop %d\n" 181 size = snprintf(buffer, 1024, "Ver 1\nBr %.6f\nIpg 1\nPpi %d\nBpiop %d\n"
182 "Pix 0\nCf %d\nCg %d\nSl 7\nnl16 %d\nVi 1\nf1 1\n", 182 "Pix 0\nCf %d\nCg %d\nSl 7\nnl16 %d\nVi 1\nf1 1\n",
183 (float)ctx->codec->bit_rate, ctx->p_per_gop, ctx->b_per_gop, 183 (float)ctx->codec->bit_rate, ctx->p_per_gop, ctx->b_per_gop,
184 ctx->codec->pix_fmt == PIX_FMT_YUV422P ? 2 : 1, ctx->first_gop_closed, 184 ctx->codec->pix_fmt == PIX_FMT_YUV422P ? 2 : 1, ctx->first_gop_closed == 1,
185 ctx->codec->height / 16); 185 ctx->codec->height / 16);
186 put_byte(pb, 0x4F); 186 put_byte(pb, 0x4F);
187 put_byte(pb, size + 1); 187 put_byte(pb, size + 1);
188 put_buffer(pb, (uint8_t *)buffer, size + 1); 188 put_buffer(pb, (uint8_t *)buffer, size + 1);
189 return size + 3; 189 return size + 3;
416 { 416 {
417 if (stream->codec->pix_fmt == PIX_FMT_YUV422P) 417 if (stream->codec->pix_fmt == PIX_FMT_YUV422P)
418 put_le32(pb, 2); 418 put_le32(pb, 2);
419 else 419 else
420 put_le32(pb, 1); /* default to 420 */ 420 put_le32(pb, 1); /* default to 420 */
421 put_le32(pb, stream->first_gop_closed); /* closed = 1, open = 0, unknown = 255 */ 421 put_le32(pb, stream->first_gop_closed == 1); /* closed = 1, open = 0, unknown = 255 */
422 put_le32(pb, 3); /* top = 1, bottom = 2, frame = 3, unknown = 0 */ 422 put_le32(pb, 3); /* top = 1, bottom = 2, frame = 3, unknown = 0 */
423 put_le32(pb, 1); /* I picture per GOP */ 423 put_le32(pb, 1); /* I picture per GOP */
424 put_le32(pb, stream->p_per_gop); 424 put_le32(pb, stream->p_per_gop);
425 put_le32(pb, stream->b_per_gop); 425 put_le32(pb, stream->b_per_gop);
426 if (stream->codec->codec_id == CODEC_ID_MPEG2VIDEO) 426 if (stream->codec->codec_id == CODEC_ID_MPEG2VIDEO)
623 sc->lines_index = -1; 623 sc->lines_index = -1;
624 sc->sample_size = st->codec->bit_rate; 624 sc->sample_size = st->codec->bit_rate;
625 sc->fields = 2; /* interlaced */ 625 sc->fields = 2; /* interlaced */
626 switch (sc->codec->codec_id) { 626 switch (sc->codec->codec_id) {
627 case CODEC_ID_MPEG2VIDEO: 627 case CODEC_ID_MPEG2VIDEO:
628 sc->first_gop_closed = -1;
628 sc->track_type = 4; 629 sc->track_type = 4;
629 gxf->mpeg_tracks++; 630 gxf->mpeg_tracks++;
630 gxf->flags |= 0x00008000; 631 gxf->flags |= 0x00008000;
631 break; 632 break;
632 case CODEC_ID_DVVIDEO: 633 case CODEC_ID_DVVIDEO:
690 { 691 {
691 uint32_t c=-1; 692 uint32_t c=-1;
692 int i; 693 int i;
693 for(i=0; i<size-4 && c!=0x100; i++){ 694 for(i=0; i<size-4 && c!=0x100; i++){
694 c = (c<<8) + buf[i]; 695 c = (c<<8) + buf[i];
695 if(c == 0x1B8) /* GOP start code */ 696 if(c == 0x1B8 && sc->first_gop_closed == -1) /* GOP start code */
696 sc->first_gop_closed= (buf[i+4]>>6)&1; 697 sc->first_gop_closed= (buf[i+4]>>6)&1;
697 } 698 }
698 return (buf[i+1]>>3)&7; 699 return (buf[i+1]>>3)&7;
699 } 700 }
700 701