Some small adjustments for for better open-a-new-file handling

Original commit message from CVS:
Some small adjustments for for better open-a-new-file handling
This commit is contained in:
Ronald S. Bultje 2002-02-03 15:47:20 +00:00
parent e9ea094528
commit 3ea3b8e8ab
2 changed files with 8 additions and 18 deletions

View file

@ -339,17 +339,12 @@ gst_disksink_chain (GstPad *pad, GstBuffer *buf)
if (disksink->maxfilesize > 0) if (disksink->maxfilesize > 0)
{ {
if ((disksink->data_written + GST_BUFFER_SIZE(buf))/(1024*1024) > disksink->maxfilesize) if ((disksink->data_written + GST_BUFFER_SIZE(buf))/(1024*1024) > disksink->maxfilesize)
{
if (GST_ELEMENT_IS_EVENT_AWARE(GST_ELEMENT(disksink)))
{ {
GstEvent *event; GstEvent *event;
event = gst_event_new(GST_EVENT_NEW_MEDIA); event = gst_event_new(GST_EVENT_NEW_MEDIA);
gst_pad_send_event(pad, event); gst_pad_send_event(pad, event);
/* if the event wasn't handled, we probably need to open a new file ourselves */
if ((disksink->data_written + GST_BUFFER_SIZE(buf))/(1024*1024) > disksink->maxfilesize)
{
gst_disksink_close_file(disksink);
disksink->filenum++;
if (!gst_disksink_open_file(disksink)) return;
} }
} }
} }

View file

@ -339,17 +339,12 @@ gst_disksink_chain (GstPad *pad, GstBuffer *buf)
if (disksink->maxfilesize > 0) if (disksink->maxfilesize > 0)
{ {
if ((disksink->data_written + GST_BUFFER_SIZE(buf))/(1024*1024) > disksink->maxfilesize) if ((disksink->data_written + GST_BUFFER_SIZE(buf))/(1024*1024) > disksink->maxfilesize)
{
if (GST_ELEMENT_IS_EVENT_AWARE(GST_ELEMENT(disksink)))
{ {
GstEvent *event; GstEvent *event;
event = gst_event_new(GST_EVENT_NEW_MEDIA); event = gst_event_new(GST_EVENT_NEW_MEDIA);
gst_pad_send_event(pad, event); gst_pad_send_event(pad, event);
/* if the event wasn't handled, we probably need to open a new file ourselves */
if ((disksink->data_written + GST_BUFFER_SIZE(buf))/(1024*1024) > disksink->maxfilesize)
{
gst_disksink_close_file(disksink);
disksink->filenum++;
if (!gst_disksink_open_file(disksink)) return;
} }
} }
} }