vc1parse: add some simple stream-format conversion

It add the support of following stream-format conversion:
- bdu --> sequence-layer-bdu
- bdu-frame --> sequence-layer-bdu-frame
- frame-layer --> sequence-layer-frame-layer

For these conversion, the only requirements is to push a sequence-layer
buffer prior to data.

https://bugzilla.gnome.org/show_bug.cgi?id=738526
This commit is contained in:
Aurélien Zanelli 2014-09-30 15:28:55 +02:00 committed by Sebastian Dröge
parent cd500c5a06
commit f2c5900c6d
2 changed files with 50 additions and 1 deletions

View file

@ -1381,6 +1381,19 @@ done:
return ret;
}
static GstFlowReturn
gst_vc1_parse_push_sequence_layer (GstVC1Parse * vc1parse)
{
GstBuffer *seq_layer;
if ((seq_layer = vc1parse->seq_layer_buffer))
gst_buffer_ref (seq_layer);
else
seq_layer = gst_vc1_parse_make_sequence_layer (vc1parse);
return gst_pad_push (GST_BASE_PARSE_SRC_PAD (vc1parse), seq_layer);
}
static GstFlowReturn
gst_vc1_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
{
@ -1470,6 +1483,16 @@ gst_vc1_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU:
switch (vc1parse->input_stream_format) {
case VC1_STREAM_FORMAT_BDU:
/* We just need to send the sequence-layer first */
if (!vc1parse->seq_layer_sent) {
ret = gst_vc1_parse_push_sequence_layer (vc1parse);
if (ret != GST_FLOW_OK) {
GST_ERROR_OBJECT (vc1parse, "push sequence layer failed");
break;
}
vc1parse->seq_layer_sent = TRUE;
}
break;
case VC1_STREAM_FORMAT_BDU_FRAME:
goto conversion_not_supported;
break;
@ -1492,7 +1515,19 @@ gst_vc1_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU_FRAME:
switch (vc1parse->input_stream_format) {
case VC1_STREAM_FORMAT_BDU:
goto conversion_not_supported;
break;
case VC1_STREAM_FORMAT_BDU_FRAME:
/* We just need to send the sequence-layer first */
if (!vc1parse->seq_layer_sent) {
ret = gst_vc1_parse_push_sequence_layer (vc1parse);
if (ret != GST_FLOW_OK) {
GST_ERROR_OBJECT (vc1parse, "push sequence layer failed");
break;
}
vc1parse->seq_layer_sent = TRUE;
}
break;
case VC1_STREAM_FORMAT_SEQUENCE_LAYER_BDU:
goto conversion_not_supported;
break;
@ -1546,9 +1581,19 @@ gst_vc1_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
g_assert_not_reached ();
break;
case VC1_STREAM_FORMAT_ASF:
case VC1_STREAM_FORMAT_FRAME_LAYER:
goto conversion_not_supported;
break;
case VC1_STREAM_FORMAT_FRAME_LAYER:
/* We just need to send the sequence-layer first */
if (!vc1parse->seq_layer_sent) {
ret = gst_vc1_parse_push_sequence_layer (vc1parse);
if (ret != GST_FLOW_OK) {
GST_ERROR_OBJECT (vc1parse, "push sequence layer failed");
break;
}
vc1parse->seq_layer_sent = TRUE;
}
break;
default:
g_assert_not_reached ();
break;

View file

@ -107,6 +107,10 @@ struct _GstVC1Parse
* valid if the GstBaseParseFrame has the
* GST_BASE_PARSE_FRAME_FLAG_PARSING flag */
GstVC1StartCode startcode;
/* TRUE if we have already sent the sequence-layer,
* use for stream-format conversion */
gboolean seq_layer_sent;
};
struct _GstVC1ParseClass