From: Wim T. <wt...@pd...> - 2004-05-06 14:32:27
|
CVS Root: /cvs/gstreamer Module: gst-plugins Changes by: wtay Date: Thu May 06 2004 07:32:26 PDT Log message: * ext/theora/theoraenc.c: (gst_theora_enc_class_init), (theora_enc_sink_link), (theora_push_packet), (theora_enc_chain), (theora_enc_set_property), (theora_enc_get_property): Also encode the first frame, cleanup some code. Modified files: . : ChangeLog ext/theora : theoraenc.c Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ChangeLog.diff?r1=1.604&r2=1.605 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gst-plugins/ext/theora/theoraenc.c.diff?r1=1.1&r2=1.2 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gst-plugins/ChangeLog,v retrieving revision 1.604 retrieving revision 1.605 diff -u -d -r1.604 -r1.605 --- a/ChangeLog 6 May 2004 09:21:24 -0000 1.604 +++ b/ChangeLog 6 May 2004 14:32:13 -0000 1.605 @@ -1,5 +1,12 @@ 2004-05-06 Wim Taymans <wi...@fl...> + * ext/theora/theoraenc.c: (gst_theora_enc_class_init), + (theora_enc_sink_link), (theora_push_packet), (theora_enc_chain), + (theora_enc_set_property), (theora_enc_get_property): + Also encode the first frame, cleanup some code. + +2004-05-06 Wim Taymans <wi...@fl...> * ext/mpeg2enc/gstmpeg2enc.cc: Forward events first before deciding that negotiation was not performed. Index: theoraenc.c RCS file: /cvs/gstreamer/gst-plugins/ext/theora/theoraenc.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- a/theoraenc.c 6 May 2004 09:10:31 -0000 1.1 +++ b/theoraenc.c 6 May 2004 14:32:14 -0000 1.2 @@ -241,6 +241,8 @@ GST_BUFFER_OFFSET_END (buf) = packet->granulepos; if (GST_PAD_IS_USABLE (enc->srcpad)) gst_pad_push (enc->srcpad, GST_DATA (buf)); + enc->packetno++; } static void @@ -255,6 +257,7 @@ return; } + /* no packets written yet, setup headers */ if (enc->packetno == 0) { GstCaps *caps; @@ -265,41 +268,39 @@ /* first packet will get its own page automatically */ theora_encode_header (&enc->state, &op); theora_push_packet (enc, &op); - enc->packetno++; - } - if (enc->packetno == 1) { /* create the remaining theora headers */ theora_comment_init (&enc->comment); theora_encode_comment (&enc->comment, &op); theora_encode_tables (&enc->state, &op); - } else if (enc->packetno > 1) { - yuv_buffer yuv; - gint y_size; - guchar *pixels; + } - pixels = GST_BUFFER_DATA (GST_BUFFER (data)); + yuv_buffer yuv; + gint y_size; + guchar *pixels; - yuv.y_width = enc->width; - yuv.y_height = enc->height; - yuv.y_stride = enc->width; + pixels = GST_BUFFER_DATA (GST_BUFFER (data)); - yuv.uv_width = enc->width / 2; - yuv.uv_height = enc->height / 2; - yuv.uv_stride = yuv.uv_width; + yuv.y_width = enc->width; + yuv.y_height = enc->height; + yuv.y_stride = enc->width; - y_size = enc->width * enc->height; + yuv.uv_width = enc->width / 2; + yuv.uv_height = enc->height / 2; + yuv.uv_stride = yuv.uv_width; - yuv.y = pixels; - yuv.u = pixels + y_size; - yuv.v = pixels + y_size * 5 / 4; + y_size = enc->width * enc->height; + yuv.y = pixels; + yuv.u = pixels + y_size; + yuv.v = pixels + y_size * 5 / 4; + theora_encode_YUVin (&enc->state, &yuv); + theora_encode_packetout (&enc->state, 0, &op); + theora_push_packet (enc, &op); - theora_encode_YUVin (&enc->state, &yuv); - theora_encode_packetout (&enc->state, 0, &op); - theora_push_packet (enc, &op); gst_data_unref (data); |