codecparsers: VC1: Use enums when possible

Add GstVC1FrameCodingMode and use it for the fcm field
Use GstVC1PictureType as variable type for ptype
Use GstVC1Level as variable type for level
This commit is contained in:
Thibault Saunier 2011-10-07 13:11:55 -03:00
parent 40a1ed8288
commit 7a689b6805
2 changed files with 31 additions and 10 deletions

View file

@ -770,10 +770,12 @@ static GstVC1ParserResult
parse_sequence_header_advanced (GstVC1SeqHdr * seqhdr, GstBitReader * br)
{
GstVC1AdvancedSeqHdr *advanced = &seqhdr->advanced;
guint8 tmp;
GST_DEBUG ("Parsing sequence header in advanced mode");
READ_UINT8 (br, advanced->level, 3);
READ_UINT8 (br, tmp, 3);
advanced->level = tmp;
READ_UINT8 (br, advanced->colordiff_format, 2);
READ_UINT8 (br, advanced->frmrtq_postproc, 3);
@ -888,7 +890,7 @@ parse_frame_header_advanced (GstBitReader * br, GstVC1FrameHdr * framehdr,
pic->fcm = (guint8) fcm;
}
framehdr->ptype = get_unary (br, 0, 4);
framehdr->ptype = (guint8) get_unary (br, 0, 4);
if (advhdr->tfcntrflag) {
READ_UINT8 (br, pic->tfcntr, 8);
@ -1118,6 +1120,10 @@ parse_frame_header_advanced (GstBitReader * br, GstVC1FrameHdr * framehdr,
pic->mvmode, pic->mvtab, pic->cbptab, pic->skipmb);
break;
default:
goto failed;
break;
}
return GST_VC1_PARSER_OK;
@ -1132,7 +1138,7 @@ static GstVC1ParserResult
parse_frame_header (GstBitReader * br, GstVC1FrameHdr * framehdr,
GstVC1SeqHdr * seqhdr, GstVC1BitPlanes * bitplanes)
{
guint8 mvmodeidx;
guint8 mvmodeidx, tmp;
GstVC1PicSimpleMain *pic = &framehdr->pic.simple;
GstVC1SeqStructC *structc = &seqhdr->struct_c;
@ -1154,12 +1160,14 @@ parse_frame_header (GstBitReader * br, GstVC1FrameHdr * framehdr,
}
/* Figuring out the picture type */
READ_UINT8 (br, framehdr->ptype, 1);
READ_UINT8 (br, tmp, 1);
framehdr->ptype = tmp;
if (structc->maxbframes) {
if (!framehdr->ptype) {
READ_UINT8 (br, framehdr->ptype, 1);
READ_UINT8 (br, tmp, 1);
if (framehdr->ptype)
if (tmp)
framehdr->ptype = GST_VC1_PICTURE_TYPE_I;
else
framehdr->ptype = GST_VC1_PICTURE_TYPE_B;
@ -1329,6 +1337,10 @@ parse_frame_header (GstBitReader * br, GstVC1FrameHdr * framehdr,
pic->directmb, pic->skipmb);
break;
default:
goto failed;
break;
}
return GST_VC1_PARSER_OK;

View file

@ -130,6 +130,13 @@ typedef enum
GST_VC1_MVMODE_INTENSITY_COMP
} GstVC1MvMode;
typedef enum
{
GST_VC1_FRAME_PROGRESSIVE = 0x0,
GST_VC1_FRAME_INTERLACE = 0x10,
GST_VC1_FIELD_INTERLACE = 0x11
} GstVC1FrameCodingMode;
typedef struct _GstVC1SeqHdr GstVC1SeqHdr;
typedef struct _GstVC1AdvancedSeqHdr GstVC1AdvancedSeqHdr;
typedef struct _GstVC1HrdParam GstVC1HrdParam;
@ -200,7 +207,8 @@ struct _GstVC1EntryPointHdr
*/
struct _GstVC1AdvancedSeqHdr
{
guint8 level;
GstVC1Level level;
guint8 frmrtq_postproc;
guint8 bitrtq_postproc;
guint8 postprocflag;
@ -248,7 +256,8 @@ struct _GstVC1SeqStructA
struct _GstVC1SeqStructB
{
guint8 level;
GstVC1Level level;
guint8 cbr;
guint32 framerate;
@ -372,7 +381,7 @@ struct _GstVC1PicSimpleMain
*/
struct _GstVC1PicAdvanced
{
guint8 fcm;
GstVC1FrameCodingMode fcm;
guint8 tfcntr;
guint8 rptfrm;
@ -477,7 +486,7 @@ struct _GstVC1FrameLayer
struct _GstVC1FrameHdr
{
/* common fields */
guint8 ptype;
GstVC1PictureType ptype;
guint8 interpfrm;
guint8 halfqp;
guint8 transacfrm;