mirror of
https://github.com/mpv-player/mpv
synced 2025-02-14 10:57:32 +00:00
Cosmetic change std ident style
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@12425 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
4e3b955a53
commit
ba0a69a969
@ -61,11 +61,13 @@ static uint32_t image_depth;
|
||||
static uint32_t image_format;
|
||||
static uint32_t image_size;
|
||||
static uint32_t image_buffer_size;
|
||||
char *image_data;
|
||||
|
||||
#ifdef QUARTZ_ENABLE_YUV
|
||||
static CodecType image_qtcodec;
|
||||
static PlanarPixmapInfoYUV420 *P;
|
||||
static struct {
|
||||
static struct
|
||||
{
|
||||
ImageSequence seqId;
|
||||
ImageDescriptionHandle desc;
|
||||
Handle extension_colr;
|
||||
@ -78,7 +80,6 @@ static DecompressorComponent mycodec;
|
||||
static ComponentInstance myopenedcodec;
|
||||
static int EnterMoviesDone = 0;
|
||||
#endif
|
||||
char *image_data;
|
||||
|
||||
extern int vo_ontop;
|
||||
extern int vo_fs;
|
||||
@ -86,7 +87,8 @@ extern int vo_fs;
|
||||
int int_pause = 0;
|
||||
float winAlpha = 1;
|
||||
|
||||
int device_width, device_height;
|
||||
int device_width;
|
||||
int device_height;
|
||||
|
||||
WindowRef theWindow;
|
||||
|
||||
@ -114,7 +116,8 @@ static OSStatus MainMouseEventHandler(EventHandlerCallRef nextHandler, EventRef
|
||||
|
||||
static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, unsigned char *srca, int stride)
|
||||
{
|
||||
switch (image_format) {
|
||||
switch (image_format)
|
||||
{
|
||||
case IMGFMT_RGB32:
|
||||
vo_draw_alpha_rgb32(w,h,src,srca,stride,image_data+4*(y0*imgRect.right+x0),4*imgRect.right);
|
||||
break;
|
||||
@ -122,9 +125,7 @@ static void draw_alpha(int x0, int y0, int w, int h, unsigned char *src, unsigne
|
||||
case IMGFMT_YV12:
|
||||
case IMGFMT_IYUV:
|
||||
case IMGFMT_I420:
|
||||
vo_draw_alpha_yv12(w,h,src,srca,stride,
|
||||
((char*)P) + P->componentInfoY.offset + x0 + y0 * image_width,
|
||||
image_width);
|
||||
vo_draw_alpha_yv12(w,h,src,srca,stride, ((char*)P) + P->componentInfoY.offset + x0 + y0 * image_width, image_width);
|
||||
break;
|
||||
case IMGFMT_UYVY:
|
||||
//vo_draw_alpha_uyvy(w,h,src,srca,stride,((char*)P) + (x0 + y0 * image_width) * 2,image_width*2);
|
||||
@ -356,18 +357,20 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32
|
||||
InstallWindowEventHandler (theWindow, NewEventHandlerUPP (MainKeyboardEventHandler), GetEventTypeCount(keyEvents), keyEvents, theWindow, NULL);
|
||||
InstallApplicationEventHandler (NewEventHandlerUPP (MainMouseEventHandler), GetEventTypeCount(mouseEvents), mouseEvents, 0, NULL);
|
||||
|
||||
//Show window
|
||||
RepositionWindow(theWindow, NULL, kWindowCascadeOnMainScreen);
|
||||
#ifdef QUARTZ_ENABLE_YUV
|
||||
if (!(IMGFMT_IS_RGB(image_format))) {
|
||||
if (!EnterMoviesDone) {
|
||||
if (!(IMGFMT_IS_RGB(image_format)))
|
||||
{
|
||||
if (!EnterMoviesDone)
|
||||
{
|
||||
qterr = EnterMovies();
|
||||
EnterMoviesDone = 1;
|
||||
}
|
||||
else
|
||||
qterr = 0;
|
||||
|
||||
mp_msg(MSGT_VO, MSGL_INFO, "\nQuartz: EnterMovies\n");
|
||||
if (qterr) {
|
||||
if (qterr)
|
||||
{
|
||||
mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: EnterMovies (%d)\n", qterr);
|
||||
}
|
||||
|
||||
@ -378,13 +381,17 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32
|
||||
char ch1[256], ch2[256];
|
||||
|
||||
qterr = FindCodec(image_qtcodec, bestSpeedCodec, NULL, &mycodec);
|
||||
if (qterr) {
|
||||
if (qterr)
|
||||
{
|
||||
mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: FindCodec (%d)\n", qterr);
|
||||
}
|
||||
|
||||
qterr = GetComponentInfo(mycodec, &cd2, h1, h2, NULL);
|
||||
if (qterr) {
|
||||
if (qterr)
|
||||
{
|
||||
mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: GetComponentInfo (%d)\n", qterr);
|
||||
}
|
||||
|
||||
memcpy(ch1, &((unsigned char*)(*h1))[1], ((unsigned char*)(*h1))[0]);
|
||||
ch1[((unsigned char*)(*h1))[0]] = '\0';
|
||||
memcpy(ch2, &((unsigned char*)(*h2))[1], ((unsigned char*)(*h2))[0]);
|
||||
@ -403,12 +410,15 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32
|
||||
{
|
||||
CodecInfo ci;
|
||||
qterr = GetCodecInfo(&ci, 'imdc', mycodec);
|
||||
if (qterr) {
|
||||
|
||||
if (qterr)
|
||||
{
|
||||
mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: GetCodecInfo (%d)\n", qterr);
|
||||
}
|
||||
mp_msg(MSGT_VO, MSGL_INFO, "Quartz: CodecInfo:\n\tname: %s\n\tvendor: %.4s\n\tversion/revision: %d/%d\n\tdecompressFlags: 0x%08x\n\tcompressFlags: 0x%08x\n\tformatFlags: 0x%08x\n", ch1, &ci.vendor, ci.version, ci.revisionLevel, ci.decompressFlags, ci.compressFlags, ci.formatFlags);
|
||||
}
|
||||
}
|
||||
|
||||
yuv_qt_stuff.desc = (ImageDescriptionHandle)NewHandleClear( sizeof(ImageDescription) );
|
||||
yuv_qt_stuff.extension_colr = NewHandleClear(sizeof(NCLCColorInfoImageDescriptionExtension));
|
||||
((NCLCColorInfoImageDescriptionExtension*)(*yuv_qt_stuff.extension_colr))->colorParamType = kVideoColorInfoImageDescriptionExtensionType;
|
||||
@ -448,33 +458,39 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32
|
||||
(*yuv_qt_stuff.desc)->clutID = -1;
|
||||
|
||||
qterr = AddImageDescriptionExtension(yuv_qt_stuff.desc, yuv_qt_stuff.extension_colr, kColorInfoImageDescriptionExtension);
|
||||
if (qterr) {
|
||||
if (qterr)
|
||||
{
|
||||
mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: AddImageDescriptionExtension [colr] (%d)\n", qterr);
|
||||
}
|
||||
|
||||
qterr = AddImageDescriptionExtension(yuv_qt_stuff.desc, yuv_qt_stuff.extension_fiel, kFieldInfoImageDescriptionExtension);
|
||||
if (qterr) {
|
||||
if (qterr)
|
||||
{
|
||||
mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: AddImageDescriptionExtension [fiel] (%d)\n", qterr);
|
||||
}
|
||||
|
||||
qterr = AddImageDescriptionExtension(yuv_qt_stuff.desc, yuv_qt_stuff.extension_clap, kCleanApertureImageDescriptionExtension);
|
||||
if (qterr) {
|
||||
if (qterr)
|
||||
{
|
||||
mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: AddImageDescriptionExtension [clap] (%d)\n", qterr);
|
||||
}
|
||||
|
||||
qterr = AddImageDescriptionExtension(yuv_qt_stuff.desc, yuv_qt_stuff.extension_pasp, kCleanApertureImageDescriptionExtension);
|
||||
if (qterr) {
|
||||
if (qterr)
|
||||
{
|
||||
mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: AddImageDescriptionExtension [pasp] (%d)\n", qterr);
|
||||
}
|
||||
|
||||
SetPort(GetWindowPort(theWindow));
|
||||
SetIdentityMatrix(&yuv_qt_stuff.matrix);
|
||||
if ((d_width != width) || (d_height != height)) {
|
||||
ScaleMatrix(&yuv_qt_stuff.matrix,
|
||||
FixDiv(Long2Fix(d_width),Long2Fix(width)),
|
||||
FixDiv(Long2Fix(d_height),Long2Fix(height)),
|
||||
0,
|
||||
0);
|
||||
if ((d_width != width) || (d_height != height))
|
||||
{
|
||||
ScaleMatrix(&yuv_qt_stuff.matrix, FixDiv(Long2Fix(d_width),Long2Fix(width)), FixDiv(Long2Fix(d_height),Long2Fix(height)), 0, 0);
|
||||
}
|
||||
|
||||
P = calloc(sizeof(PlanarPixmapInfoYUV420) + image_size, 1);
|
||||
switch (image_format) {
|
||||
switch (image_format)
|
||||
{
|
||||
case IMGFMT_YV12:
|
||||
case IMGFMT_IYUV:
|
||||
case IMGFMT_I420:
|
||||
@ -491,9 +507,9 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32
|
||||
image_buffer_size = image_size;
|
||||
break;
|
||||
}
|
||||
|
||||
mp_msg(MSGT_VO, MSGL_INFO, "Quartz: DecompressSequenceBeginS\n");
|
||||
mp_msg(MSGT_VO, MSGL_INFO, "Quartz: width=%d, height=%d, d_width=%d, d_height=%d\n",
|
||||
width, height, d_width, d_height);
|
||||
mp_msg(MSGT_VO, MSGL_INFO, "Quartz: width=%d, height=%d, d_width=%d, d_height=%d\n", width, height, d_width, d_height);
|
||||
myopenedcodec = OpenComponent(mycodec);
|
||||
|
||||
qterr = DecompressSequenceBeginS(&yuv_qt_stuff.seqId,
|
||||
@ -512,13 +528,16 @@ static uint32_t config(uint32_t width, uint32_t height, uint32_t d_width, uint32
|
||||
bestSpeedCodec);
|
||||
//mycodec); // some codec reported by FindCodec() won't work (?)
|
||||
//myopenedcodec); // doesn't seem to help, either
|
||||
if (qterr) {
|
||||
if (qterr)
|
||||
{
|
||||
mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: DecompressSequenceBeginS (%d)\n", qterr);
|
||||
}
|
||||
mp_msg(MSGT_VO, MSGL_INFO, "Quartz: DecompressSequenceBeginS done\n");
|
||||
}
|
||||
#endif /* QUARTZ_ENABLE_YUV */
|
||||
|
||||
//Show window
|
||||
RepositionWindow(theWindow, NULL, kWindowCascadeOnMainScreen);
|
||||
ShowWindow (theWindow);
|
||||
|
||||
if(vo_fs)
|
||||
@ -690,17 +709,20 @@ static uint32_t query_format(uint32_t format)
|
||||
#ifdef QUARTZ_ENABLE_YUV
|
||||
image_qtcodec = 0;
|
||||
|
||||
if ((format == IMGFMT_YV12) || (format == IMGFMT_IYUV) || (format == IMGFMT_I420)) {
|
||||
if ((format == IMGFMT_YV12) || (format == IMGFMT_IYUV) || (format == IMGFMT_I420))
|
||||
{
|
||||
image_qtcodec = kMpegYUV420CodecType; //kYUV420CodecType ?;
|
||||
return VFCAP_CSP_SUPPORTED | VFCAP_OSD | VFCAP_SWSCALE | VFCAP_ACCEPT_STRIDE;
|
||||
}
|
||||
|
||||
if (format == IMGFMT_YUY2) {
|
||||
if (format == IMGFMT_YUY2)
|
||||
{
|
||||
image_qtcodec = kComponentVideoUnsigned;
|
||||
return VFCAP_CSP_SUPPORTED | VFCAP_OSD | VFCAP_SWSCALE;
|
||||
}
|
||||
|
||||
if (format == IMGFMT_UYVY) {
|
||||
if (format == IMGFMT_UYVY)
|
||||
{
|
||||
image_qtcodec = k422YpCbCr8CodecType;
|
||||
return VFCAP_CSP_SUPPORTED | VFCAP_OSD | VFCAP_SWSCALE;
|
||||
}
|
||||
@ -711,7 +733,8 @@ static uint32_t query_format(uint32_t format)
|
||||
|
||||
static void uninit(void)
|
||||
{
|
||||
switch (image_format) {
|
||||
switch (image_format)
|
||||
{
|
||||
case IMGFMT_YV12:
|
||||
case IMGFMT_IYUV:
|
||||
case IMGFMT_I420:
|
||||
@ -719,14 +742,18 @@ static void uninit(void)
|
||||
case IMGFMT_YUY2:
|
||||
{
|
||||
OSErr qterr;
|
||||
if (EnterMoviesDone) {
|
||||
|
||||
if (EnterMoviesDone)
|
||||
{
|
||||
qterr = CDSequenceEnd(yuv_qt_stuff.seqId);
|
||||
if (qterr) {
|
||||
if (qterr)
|
||||
{
|
||||
mp_msg(MSGT_VO, MSGL_FATAL, "Quartz error: CDSequenceEnd (%d)\n", qterr);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -739,20 +766,24 @@ static uint32_t preinit(const char *arg)
|
||||
}
|
||||
|
||||
#ifdef QUARTZ_ENABLE_YUV
|
||||
static uint32_t draw_yuv_image(mp_image_t *mpi) {
|
||||
static uint32_t draw_yuv_image(mp_image_t *mpi)
|
||||
{
|
||||
// ATM we're only called for planar IMGFMT
|
||||
// drawing is done directly in P
|
||||
// and displaying is in flip_page.
|
||||
return VO_TRUE;
|
||||
}
|
||||
|
||||
static uint32_t get_yuv_image(mp_image_t *mpi) {
|
||||
static uint32_t get_yuv_image(mp_image_t *mpi)
|
||||
{
|
||||
if(mpi->type!=MP_IMGTYPE_EXPORT) return VO_FALSE;
|
||||
|
||||
if(mpi->imgfmt!=image_format) return VO_FALSE;
|
||||
|
||||
if(mpi->flags&MP_IMGFLAG_PLANAR){
|
||||
if (mpi->num_planes != 3) {
|
||||
if(mpi->flags&MP_IMGFLAG_PLANAR)
|
||||
{
|
||||
if (mpi->num_planes != 3)
|
||||
{
|
||||
mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: only 3 planes allowed in get_yuv_image for planar (%d) \n", mpi->num_planes);
|
||||
return VO_FALSE;
|
||||
}
|
||||
@ -761,23 +792,30 @@ static uint32_t get_yuv_image(mp_image_t *mpi) {
|
||||
mpi->stride[0]=image_width;
|
||||
mpi->width=image_width;
|
||||
|
||||
if(mpi->flags&MP_IMGFLAG_SWAPPED){
|
||||
if(mpi->flags&MP_IMGFLAG_SWAPPED)
|
||||
{
|
||||
// I420
|
||||
mpi->planes[1]=((char*)P) + P->componentInfoCb.offset;
|
||||
mpi->planes[2]=((char*)P) + P->componentInfoCr.offset;
|
||||
mpi->stride[1]=image_width/2;
|
||||
mpi->stride[2]=image_width/2;
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
// YV12
|
||||
mpi->planes[1]=((char*)P) + P->componentInfoCr.offset;
|
||||
mpi->planes[2]=((char*)P) + P->componentInfoCb.offset;
|
||||
mpi->stride[1]=image_width/2;
|
||||
mpi->stride[2]=image_width/2;
|
||||
}
|
||||
|
||||
mpi->flags|=MP_IMGFLAG_DIRECT;
|
||||
return VO_TRUE;
|
||||
} else { // doesn't work yet
|
||||
if (mpi->num_planes != 1) {
|
||||
}
|
||||
else
|
||||
{ // doesn't work yet
|
||||
if (mpi->num_planes != 1)
|
||||
{
|
||||
mp_msg(MSGT_VO, MSGL_ERR, "Quartz error: only 1 plane allowed in get_yuv_image for packed (%d) \n", mpi->num_planes);
|
||||
return VO_FALSE;
|
||||
}
|
||||
@ -803,7 +841,8 @@ static uint32_t control(uint32_t request, void *data, ...)
|
||||
case VOCTRL_QUERY_FORMAT: return query_format(*((uint32_t*)data));
|
||||
#ifdef QUARTZ_ENABLE_YUV
|
||||
case VOCTRL_GET_IMAGE:
|
||||
switch (image_format) {
|
||||
switch (image_format)
|
||||
{
|
||||
case IMGFMT_YV12:
|
||||
case IMGFMT_IYUV:
|
||||
case IMGFMT_I420:
|
||||
@ -813,7 +852,8 @@ static uint32_t control(uint32_t request, void *data, ...)
|
||||
break;
|
||||
}
|
||||
case VOCTRL_DRAW_IMAGE:
|
||||
switch (image_format) {
|
||||
switch (image_format)
|
||||
{
|
||||
case IMGFMT_YV12:
|
||||
case IMGFMT_IYUV:
|
||||
case IMGFMT_I420:
|
||||
@ -860,14 +900,14 @@ void window_resized()
|
||||
CreateCGContextForPort(GetWindowPort(theWindow),&context);
|
||||
|
||||
//fill background with black
|
||||
CGRect winBounds = CGRectMake( winRect.top, winRect.left, winRect.right, winRect.bottom);
|
||||
CGContextSetRGBFillColor(context, 0.0, 0.0, 0.0, 1.0);
|
||||
CGContextFillRect(context, winBounds);
|
||||
CGContextFlush(context);
|
||||
//CGRect winBounds = CGRectMake( winRect.top, winRect.left, winRect.right, winRect.bottom);
|
||||
//CGContextSetRGBFillColor(context, 0.0, 0.0, 0.0, 1.0);
|
||||
//CGContextFillRect(context, winBounds);
|
||||
//CGContextFlush(context);
|
||||
|
||||
|
||||
switch (image_format) {
|
||||
#ifdef QUARTZ_ENABLE_YUV
|
||||
switch (image_format)
|
||||
{
|
||||
case IMGFMT_YV12:
|
||||
case IMGFMT_IYUV:
|
||||
case IMGFMT_I420:
|
||||
@ -878,23 +918,19 @@ void window_resized()
|
||||
long scale_Y = FixDiv(Long2Fix(dstRect.bottom - dstRect.top),Long2Fix(image_height));
|
||||
|
||||
SetIdentityMatrix(&yuv_qt_stuff.matrix);
|
||||
if (((dstRect.right - dstRect.left) != image_width) ||
|
||||
((dstRect.bottom - dstRect.right) != image_height)) {
|
||||
ScaleMatrix(&yuv_qt_stuff.matrix,
|
||||
scale_X,
|
||||
scale_Y,
|
||||
0,
|
||||
0);
|
||||
if (((dstRect.right - dstRect.left) != image_width) || ((dstRect.bottom - dstRect.right) != image_height))
|
||||
{
|
||||
ScaleMatrix(&yuv_qt_stuff.matrix, scale_X, scale_Y, 0, 0);
|
||||
|
||||
if (padding > 0) {
|
||||
TranslateMatrix(&yuv_qt_stuff.matrix,
|
||||
Long2Fix(dstRect.left),
|
||||
Long2Fix(dstRect.top));
|
||||
if (padding > 0)
|
||||
{
|
||||
TranslateMatrix(&yuv_qt_stuff.matrix, Long2Fix(dstRect.left), Long2Fix(dstRect.top));
|
||||
}
|
||||
}
|
||||
|
||||
SetDSequenceMatrix(yuv_qt_stuff.seqId, &yuv_qt_stuff.matrix);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
@ -972,4 +1008,3 @@ void window_fullscreen()
|
||||
|
||||
window_resized();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user