|
|
|
@ -27,6 +27,7 @@ |
|
|
|
|
#include <SDL_thread.h> |
|
|
|
|
|
|
|
|
|
#include "libavutil/avstring.h" |
|
|
|
|
#include "libavutil/imgutils.h" |
|
|
|
|
#include "libavutil/opt.h" |
|
|
|
|
#include "libavutil/parseutils.h" |
|
|
|
|
#include "libavutil/pixdesc.h" |
|
|
|
@ -315,22 +316,23 @@ static int sdl_write_packet(AVFormatContext *s, AVPacket *pkt) |
|
|
|
|
{ |
|
|
|
|
SDLContext *sdl = s->priv_data; |
|
|
|
|
AVCodecContext *encctx = s->streams[0]->codec; |
|
|
|
|
AVPicture pict; |
|
|
|
|
uint8_t *data[4]; |
|
|
|
|
int linesize[4]; |
|
|
|
|
int i; |
|
|
|
|
|
|
|
|
|
if (sdl->quit) { |
|
|
|
|
sdl_write_trailer(s); |
|
|
|
|
return AVERROR(EIO); |
|
|
|
|
} |
|
|
|
|
avpicture_fill(&pict, pkt->data, encctx->pix_fmt, encctx->width, encctx->height); |
|
|
|
|
av_image_fill_arrays(data, linesize, pkt->data, encctx->pix_fmt, encctx->width, encctx->height, 1); |
|
|
|
|
|
|
|
|
|
SDL_LockMutex(sdl->mutex); |
|
|
|
|
SDL_FillRect(sdl->surface, &sdl->surface->clip_rect, |
|
|
|
|
SDL_MapRGB(sdl->surface->format, 0, 0, 0)); |
|
|
|
|
SDL_LockYUVOverlay(sdl->overlay); |
|
|
|
|
for (i = 0; i < 3; i++) { |
|
|
|
|
sdl->overlay->pixels [i] = pict.data [i]; |
|
|
|
|
sdl->overlay->pitches[i] = pict.linesize[i]; |
|
|
|
|
sdl->overlay->pixels [i] = data [i]; |
|
|
|
|
sdl->overlay->pitches[i] = linesize[i]; |
|
|
|
|
} |
|
|
|
|
SDL_DisplayYUVOverlay(sdl->overlay, &sdl->overlay_rect); |
|
|
|
|
SDL_UnlockYUVOverlay(sdl->overlay); |
|
|
|
|