Commit 5dcf77d8 authored by Rémi Bernon's avatar Rémi Bernon Committed by Alexandre Julliard

winegstreamer: Remove copying support from wg_transform_push_data.

parent ca0719f4
...@@ -102,9 +102,6 @@ void wg_parser_stream_seek(struct wg_parser_stream *stream, double rate, ...@@ -102,9 +102,6 @@ void wg_parser_stream_seek(struct wg_parser_stream *stream, double rate,
struct wg_transform *wg_transform_create(const struct wg_format *input_format, struct wg_transform *wg_transform_create(const struct wg_format *input_format,
const struct wg_format *output_format); const struct wg_format *output_format);
void wg_transform_destroy(struct wg_transform *transform); void wg_transform_destroy(struct wg_transform *transform);
HRESULT wg_transform_push_data(struct wg_transform *transform, struct wg_sample *sample);
HRESULT wg_transform_read_data(struct wg_transform *transform, struct wg_sample *sample,
struct wg_format *format);
unsigned int wg_format_get_max_size(const struct wg_format *format); unsigned int wg_format_get_max_size(const struct wg_format *format);
......
...@@ -121,8 +121,6 @@ enum wg_sample_flag ...@@ -121,8 +121,6 @@ enum wg_sample_flag
WG_SAMPLE_FLAG_HAS_PTS = 2, WG_SAMPLE_FLAG_HAS_PTS = 2,
WG_SAMPLE_FLAG_HAS_DURATION = 4, WG_SAMPLE_FLAG_HAS_DURATION = 4,
WG_SAMPLE_FLAG_SYNC_POINT = 8, WG_SAMPLE_FLAG_SYNC_POINT = 8,
WG_SAMPLE_FLAG_HAS_REFCOUNT = 0x10000, /* sample is queued on the client side and may be wrapped */
}; };
struct wg_sample struct wg_sample
......
...@@ -185,7 +185,6 @@ static void wg_sample_queue_begin_append(struct wg_sample_queue *queue, struct w ...@@ -185,7 +185,6 @@ static void wg_sample_queue_begin_append(struct wg_sample_queue *queue, struct w
/* make sure a concurrent wg_sample_queue_flush call won't release the sample until we're done */ /* make sure a concurrent wg_sample_queue_flush call won't release the sample until we're done */
InterlockedIncrement(&wg_sample->refcount); InterlockedIncrement(&wg_sample->refcount);
sample->wg_sample.flags |= WG_SAMPLE_FLAG_HAS_REFCOUNT;
EnterCriticalSection(&queue->cs); EnterCriticalSection(&queue->cs);
list_add_tail(&queue->samples, &sample->entry); list_add_tail(&queue->samples, &sample->entry);
...@@ -245,6 +244,13 @@ void wg_sample_queue_destroy(struct wg_sample_queue *queue) ...@@ -245,6 +244,13 @@ void wg_sample_queue_destroy(struct wg_sample_queue *queue)
free(queue); free(queue);
} }
/* These unixlib entry points should not be used directly, they assume samples
* to be queued and zero-copy support, use the helpers below instead.
*/
HRESULT wg_transform_push_data(struct wg_transform *transform, struct wg_sample *sample);
HRESULT wg_transform_read_data(struct wg_transform *transform, struct wg_sample *sample,
struct wg_format *format);
HRESULT wg_transform_push_mf(struct wg_transform *transform, struct wg_sample *wg_sample, HRESULT wg_transform_push_mf(struct wg_transform *transform, struct wg_sample *wg_sample,
struct wg_sample_queue *queue) struct wg_sample_queue *queue)
{ {
......
...@@ -542,17 +542,7 @@ NTSTATUS wg_transform_push_data(void *args) ...@@ -542,17 +542,7 @@ NTSTATUS wg_transform_push_data(void *args)
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }
if (!(sample->flags & WG_SAMPLE_FLAG_HAS_REFCOUNT)) if (!(buffer = gst_buffer_new_wrapped_full(GST_MEMORY_FLAG_READONLY, sample->data, sample->max_size,
{
if (!(buffer = gst_buffer_new_and_alloc(sample->size)))
{
GST_ERROR("Failed to allocate input buffer");
return STATUS_NO_MEMORY;
}
gst_buffer_fill(buffer, 0, sample->data, sample->size);
GST_INFO("Copied %u bytes from sample %p to buffer %p", sample->size, sample, buffer);
}
else if (!(buffer = gst_buffer_new_wrapped_full(GST_MEMORY_FLAG_READONLY, sample->data, sample->max_size,
0, sample->size, sample, wg_sample_free_notify))) 0, sample->size, sample, wg_sample_free_notify)))
{ {
GST_ERROR("Failed to allocate input buffer"); GST_ERROR("Failed to allocate input buffer");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment