static void copy_picture(void *dst, void *opaque, size_t size)
{
DataContainer *dc = (DataContainer *)opaque;
+
if (dc->len_data_buffer) {
memcpy(dst, dc->data_buffer, dc->len_data_buffer);
}
if (dc->frame) {
- avpicture_layout((AVPicture *)dc->frame, PIX_FMT_YUV420P, dc->frame->width, dc->frame->height,
- dst + OFFSET_PICTURE_BUFFER, size - OFFSET_PICTURE_BUFFER); // FIXME
+ avpicture_layout((AVPicture *)dc->frame, dc->pix_fmt, dc->frame->width, dc->frame->height,
+ dst + dc->picture_buffer_offset, size - dc->picture_buffer_offset); // FIXME
}
}
memcpy(tempbuf + size, &got_picture, sizeof(got_picture));
size += sizeof(got_picture);
if (avctx) {
- avctx->pix_fmt = AV_PIX_FMT_YUV420P; // FIXME
deserialize_video_data(avctx, &video);
memcpy(tempbuf + size, &video, sizeof(struct video_data));
}
}
- TRACE("decoded image. pix_fmt: %d width: %d, height: %d\n",
- avctx->pix_fmt, avctx->width, avctx->height);
- int pict_size = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
+ TRACE("decoded image. len: %d got_picture: %d pix_fmt: %d width: %d, height: %d\n",
+ len, got_picture, avctx->pix_fmt, avctx->width, avctx->height);
+
+ int pict_size = 0;
bool ret = true;
- if ((pict_size) < 0) {
- ERR("picture size: %d\n", pict_size);
- ret = false;
- } else {
- TRACE("picture size: %d\n", pict_size);
+ DataContainer *dc = g_malloc0(sizeof(DataContainer));
+ dc->data_buffer = tempbuf;
+ dc->len_data_buffer = tempbuf_size;
+ dc->picture_buffer_offset = OFFSET_PICTURE_BUFFER;
- DataContainer *dc = g_malloc0(sizeof(DataContainer));
- dc->data_buffer = tempbuf;
- dc->len_data_buffer = tempbuf_size;
- if (got_picture) {
- dc->frame = picture;
- }
+ if (got_picture) {
+ pict_size = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
- if (CONTEXT(s, ctx_id)->is_hwaccel) {
- brillcodec_push_write_queue(s, dc, OFFSET_PICTURE_BUFFER + pict_size, ctx_id, s->hwaccel_plugin->video_decode_data_handler);
+ if ((pict_size) < 0) {
+ ERR("picture size: %d\n", pict_size);
+ ret = false;
} else {
- brillcodec_push_write_queue(s, dc, OFFSET_PICTURE_BUFFER + pict_size, ctx_id, &default_video_decode_data_handler);
+ TRACE("picture size: %d\n", pict_size);
+
+ dc->frame = picture;
+ dc->pix_fmt = avctx->pix_fmt;
}
}
+ if (CONTEXT(s, ctx_id)->is_hwaccel) {
+ brillcodec_push_write_queue(s, dc, dc->picture_buffer_offset + pict_size, ctx_id, s->hwaccel_plugin->video_decode_data_handler);
+ } else {
+ brillcodec_push_write_queue(s, dc, dc->picture_buffer_offset + pict_size, ctx_id, &default_video_decode_data_handler);
+ }
+
TRACE("leave: %s\n", __func__);
return ret;
memcpy(tempbuf + size, &got_picture, sizeof(got_picture));
size += sizeof(got_picture);
if (avctx) {
- avctx->pix_fmt = AV_PIX_FMT_YUV420P; // FIXME
deserialize_video_data(avctx, &video);
memcpy(tempbuf + size, &video, sizeof(struct video_data));
}
DataContainer *dc = g_malloc0(sizeof(DataContainer));
dc->frame = frame;
+ dc->pix_fmt = avctx->pix_fmt;
if (CONTEXT(s, ctx_id)->is_hwaccel) {
brillcodec_push_write_queue(s, dc, pict_size, ctx_id, s->hwaccel_plugin->video_decode_data_handler);