mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
codecparsers: VC1: Implement FrameLayer parsing
This commit is contained in:
parent
fc09e45108
commit
1a1935dacf
2 changed files with 58 additions and 0 deletions
|
@ -1617,6 +1617,47 @@ failed:
|
|||
return GST_VC1_PARSER_ERROR;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vc1_parse_frame_layer:
|
||||
* @data: The data to parse
|
||||
* @size: the size of @data
|
||||
* @framelayer: The #GstVC1FrameLayer to fill.
|
||||
*
|
||||
* Parses @data, and fills @framelayer fields.
|
||||
*
|
||||
* Returns: a #GstVC1ParserResult
|
||||
*/
|
||||
GstVC1ParserResult
|
||||
gst_vc1_parse_frame_layer (const guint8 * data, gsize size,
|
||||
GstVC1FrameLayer * framelayer)
|
||||
{
|
||||
GstBitReader br = GST_BIT_READER_INIT (data, size);
|
||||
|
||||
if (gst_bit_reader_get_remaining (&br) < 64) {
|
||||
GST_WARNING ("Could not parse frame layer");
|
||||
|
||||
return GST_VC1_PARSER_ERROR;
|
||||
}
|
||||
|
||||
/* set default values */
|
||||
framelayer->skiped_p_frame = 0;
|
||||
|
||||
framelayer->key = gst_bit_reader_get_bits_uint8_unchecked (&br, 1);
|
||||
gst_bit_reader_skip_unchecked (&br, 7);
|
||||
|
||||
framelayer->framesize = gst_bit_reader_get_bits_uint32_unchecked (&br, 24);
|
||||
|
||||
if (framelayer->framesize == 0 || framelayer->framesize == 1)
|
||||
framelayer->skiped_p_frame = 1;
|
||||
|
||||
/* compute next_framelayer_offset */
|
||||
framelayer->next_framelayer_offset = framelayer->framesize + 8;
|
||||
|
||||
framelayer->timestamp = gst_bit_reader_get_bits_uint32_unchecked (&br, 32);
|
||||
|
||||
return GST_VC1_PARSER_OK;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_vc1_parse_frame_header:
|
||||
* @data: The data to parse
|
||||
|
|
|
@ -139,6 +139,7 @@ typedef struct _GstVC1SeqStructB GstVC1SeqStructB;
|
|||
typedef struct _GstVC1SeqStructC GstVC1SeqStructC;
|
||||
|
||||
/* Pictures Structures */
|
||||
typedef struct _GstVC1FrameLayer GstVC1FrameLayer;
|
||||
typedef struct _GstVC1FrameHdr GstVC1FrameHdr;
|
||||
typedef struct _GstVC1PicAdvanced GstVC1PicAdvanced;
|
||||
typedef struct _GstVC1PicSimpleMain GstVC1PicSimpleMain;
|
||||
|
@ -438,6 +439,18 @@ struct _GstVC1VopDquant
|
|||
|
||||
};
|
||||
|
||||
struct _GstVC1FrameLayer
|
||||
{
|
||||
guint8 key;
|
||||
guint32 framesize;
|
||||
|
||||
guint32 timestamp;
|
||||
|
||||
/* calculated */
|
||||
guint32 next_framelayer_offset;
|
||||
guint8 skiped_p_frame;
|
||||
};
|
||||
|
||||
/**
|
||||
* GstVC1FrameHdr:
|
||||
*
|
||||
|
@ -521,6 +534,10 @@ gst_vc1_parse_sequence_header_struct_c (const guint8 *data,
|
|||
gsize size,
|
||||
GstVC1SeqStructC *structc);
|
||||
|
||||
GstVC1ParserResult gst_vc1_parse_frame_layer (const guint8 *data,
|
||||
gsize size,
|
||||
GstVC1FrameLayer * framelayer);
|
||||
|
||||
GstVC1ParserResult gst_vc1_parse_frame_header (const guint8 *data,
|
||||
gsize size,
|
||||
GstVC1FrameHdr * framehdr,
|
||||
|
|
Loading…
Reference in a new issue