Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
af7491b0
Commit
af7491b0
authored
Jul 23, 2011
by
Felix Paul Kühne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: don't use NSNotifcations to feed debug messages to the interface
that's hilariously slow and CPU intensive
parent
84e7af11
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
28 deletions
+18
-28
modules/gui/macosx/intf.h
modules/gui/macosx/intf.h
+2
-0
modules/gui/macosx/intf.m
modules/gui/macosx/intf.m
+16
-28
No files found.
modules/gui/macosx/intf.h
View file @
af7491b0
...
@@ -205,6 +205,8 @@ struct intf_sys_t
...
@@ -205,6 +205,8 @@ struct intf_sys_t
-
(
IBAction
)
saveDebugLog
:(
id
)
sender
;
-
(
IBAction
)
saveDebugLog
:(
id
)
sender
;
-
(
IBAction
)
showMessagesPanel
:(
id
)
sender
;
-
(
IBAction
)
showMessagesPanel
:(
id
)
sender
;
-
(
void
)
processReceivedlibvlcMessage
:(
const
msg_item_t
*
)
item
;
-
(
IBAction
)
togglePlaylist
:(
id
)
sender
;
-
(
IBAction
)
togglePlaylist
:(
id
)
sender
;
-
(
void
)
updateTogglePlaylistState
;
-
(
void
)
updateTogglePlaylistState
;
...
...
modules/gui/macosx/intf.m
View file @
af7491b0
...
@@ -112,6 +112,7 @@ static int WindowControl( vout_window_t *, int i_query, va_list );
...
@@ -112,6 +112,7 @@ static int WindowControl( vout_window_t *, int i_query, va_list );
int
WindowOpen
(
vout_window_t
*
p_wnd
,
const
vout_window_cfg_t
*
cfg
)
int
WindowOpen
(
vout_window_t
*
p_wnd
,
const
vout_window_cfg_t
*
cfg
)
{
{
NSAutoreleasePool
*
o_pool
=
[[
NSAutoreleasePool
alloc
]
init
];
intf_thread_t
*
p_intf
=
VLCIntf
;
intf_thread_t
*
p_intf
=
VLCIntf
;
if
(
!
p_intf
)
{
if
(
!
p_intf
)
{
msg_Err
(
p_wnd
,
"Mac OS X interface not found"
);
msg_Err
(
p_wnd
,
"Mac OS X interface not found"
);
...
@@ -127,6 +128,7 @@ int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg )
...
@@ -127,6 +128,7 @@ int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg )
if
(
!
p_wnd
->
handle
.
nsobject
)
{
if
(
!
p_wnd
->
handle
.
nsobject
)
{
msg_Err
(
p_wnd
,
"got no video view from the interface"
);
msg_Err
(
p_wnd
,
"got no video view from the interface"
);
[
o_pool
release
];
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
...
@@ -134,6 +136,7 @@ int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg )
...
@@ -134,6 +136,7 @@ int WindowOpen( vout_window_t *p_wnd, const vout_window_cfg_t *cfg )
[[
VLCMainWindow
sharedInstance
]
togglePlaylist
:
nil
];
[[
VLCMainWindow
sharedInstance
]
togglePlaylist
:
nil
];
p_wnd
->
control
=
WindowControl
;
p_wnd
->
control
=
WindowControl
;
p_wnd
->
sys
=
(
vout_window_sys_t
*
)
VLCIntf
;
p_wnd
->
sys
=
(
vout_window_sys_t
*
)
VLCIntf
;
[
o_pool
release
];
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -153,9 +156,11 @@ static int WindowControl( vout_window_t *p_wnd, int i_query, va_list args )
...
@@ -153,9 +156,11 @@ static int WindowControl( vout_window_t *p_wnd, int i_query, va_list args )
void
WindowClose
(
vout_window_t
*
p_wnd
)
void
WindowClose
(
vout_window_t
*
p_wnd
)
{
{
NSAutoreleasePool
*
o_pool
=
[[
NSAutoreleasePool
alloc
]
init
];
[[
VLCMainWindow
sharedInstance
]
setVideoplayEnabled
:
NO
];
[[
VLCMainWindow
sharedInstance
]
setVideoplayEnabled
:
NO
];
NSLog
(
@"Window Close"
);
NSLog
(
@"Window Close"
);
// tell the interface to get rid of the video, TODO
// tell the interface to get rid of the video, TODO
[
o_pool
release
];
}
}
/*****************************************************************************
/*****************************************************************************
...
@@ -197,27 +202,20 @@ static void Run( intf_thread_t *p_intf )
...
@@ -197,27 +202,20 @@ static void Run( intf_thread_t *p_intf )
/*****************************************************************************
/*****************************************************************************
* MsgCallback: Callback triggered by the core once a new debug message is
* MsgCallback: Callback triggered by the core once a new debug message is
* ready to be displayed. We store everything in a NSArray in our Cocoa part
* ready to be displayed. We store everything in a NSArray in our Cocoa part
* of this file
, so we are forwarding everything through notifications
.
* of this file.
*****************************************************************************/
*****************************************************************************/
static
void
MsgCallback
(
msg_cb_data_t
*
data
,
const
msg_item_t
*
item
)
static
void
MsgCallback
(
msg_cb_data_t
*
data
,
const
msg_item_t
*
item
)
{
{
int
canc
=
vlc_savecancel
();
int
canc
=
vlc_savecancel
();
NSAutoreleasePool
*
o_pool
=
[[
NSAutoreleasePool
alloc
]
init
];
/* this may happen from time to time, let's bail out as info would be useless anyway */
/* this may happen from time to time, let's bail out as info would be useless anyway */
if
(
!
item
->
psz_module
||
!
item
->
psz_msg
)
if
(
!
item
->
psz_module
||
!
item
->
psz_msg
)
return
;
return
;
NSDictionary
*
o_dict
=
[
NSDictionary
dictionaryWithObjectsAndKeys
:
NSAutoreleasePool
*
o_pool
=
[[
NSAutoreleasePool
alloc
]
init
];
[
NSString
stringWithUTF8String
:
item
->
psz_module
],
@"Module"
,
[[
VLCMain
sharedInstance
]
processReceivedlibvlcMessage
:
item
];
[
NSString
stringWithUTF8String
:
item
->
psz_msg
],
@"Message"
,
[
NSNumber
numberWithInt
:
item
->
i_type
],
@"Type"
,
nil
];
[[
NSNotificationCenter
defaultCenter
]
postNotificationName
:
@"VLCCoreMessageReceived"
object:
nil
userInfo:
o_dict
];
[
o_pool
release
];
[
o_pool
release
];
vlc_restorecancel
(
canc
);
vlc_restorecancel
(
canc
);
}
}
...
@@ -1706,7 +1704,7 @@ end:
...
@@ -1706,7 +1704,7 @@ end:
}
}
}
}
-
(
void
)
libvlcMessageReceived
:
(
NSNotification
*
)
o_notification
-
(
void
)
processReceivedlibvlcMessage
:(
const
msg_item_t
*
)
item
{
{
NSColor
*
o_white
=
[
NSColor
whiteColor
];
NSColor
*
o_white
=
[
NSColor
whiteColor
];
NSColor
*
o_red
=
[
NSColor
redColor
];
NSColor
*
o_red
=
[
NSColor
redColor
];
...
@@ -1714,14 +1712,12 @@ end:
...
@@ -1714,14 +1712,12 @@ end:
NSColor
*
o_gray
=
[
NSColor
grayColor
];
NSColor
*
o_gray
=
[
NSColor
grayColor
];
NSColor
*
pp_color
[
4
]
=
{
o_white
,
o_red
,
o_yellow
,
o_gray
};
NSColor
*
pp_color
[
4
]
=
{
o_white
,
o_red
,
o_yellow
,
o_gray
};
static
const
char
*
ppsz_type
[
4
]
=
{
": "
,
" error: "
,
static
const
char
*
ppsz_type
[
4
]
=
{
": "
,
" error: "
,
" warning: "
,
" debug: "
};
" warning: "
,
" debug: "
};
NSString
*
o_msg
;
NSDictionary
*
o_attr
;
NSDictionary
*
o_attr
;
NSAttributedString
*
o_msg_color
;
NSAttributedString
*
o_msg_color
;
int
i_type
=
[[[
o_notification
userInfo
]
objectForKey
:
@"Type"
]
intValue
]
;
int
i_type
=
item
->
i_type
;
[
o_msg_lock
lock
];
[
o_msg_lock
lock
];
...
@@ -1731,20 +1727,12 @@ end:
...
@@ -1731,20 +1727,12 @@ end:
[
o_msg_arr
removeObjectAtIndex
:
1
];
[
o_msg_arr
removeObjectAtIndex
:
1
];
}
}
o_attr
=
[
NSDictionary
dictionaryWithObject
:
o_gray
o_attr
=
[
NSDictionary
dictionaryWithObject
:
o_gray
forKey
:
NSForegroundColorAttributeName
];
forKey:
NSForegroundColorAttributeName
];
o_msg_color
=
[[
NSAttributedString
alloc
]
initWithString
:
[
NSString
stringWithFormat
:
@"%s%s"
,
item
->
psz_module
,
ppsz_type
[
i_type
]]
attributes
:
o_attr
];
o_msg
=
[
NSString
stringWithFormat
:
@"%@%s"
,
[[
o_notification
userInfo
]
objectForKey
:
@"Module"
],
ppsz_type
[
i_type
]];
o_msg_color
=
[[
NSAttributedString
alloc
]
initWithString:
o_msg
attributes
:
o_attr
];
[
o_msg_arr
addObject
:
[
o_msg_color
autorelease
]];
[
o_msg_arr
addObject
:
[
o_msg_color
autorelease
]];
o_attr
=
[
NSDictionary
dictionaryWithObject
:
pp_color
[
i_type
]
o_attr
=
[
NSDictionary
dictionaryWithObject
:
pp_color
[
i_type
]
forKey
:
NSForegroundColorAttributeName
];
forKey:
NSForegroundColorAttributeName
];
o_msg_color
=
[[
NSAttributedString
alloc
]
initWithString
:
[
NSString
stringWithFormat
:
@"%s
\n
"
,
item
->
psz_msg
]
attributes
:
o_attr
];
o_msg
=
[[[
o_notification
userInfo
]
objectForKey
:
@"Message"
]
stringByAppendingString
:
@"
\n
"
];
o_msg_color
=
[[
NSAttributedString
alloc
]
initWithString:
o_msg
attributes
:
o_attr
];
[
o_msg_arr
addObject
:
[
o_msg_color
autorelease
]];
[
o_msg_arr
addObject
:
[
o_msg_color
autorelease
]];
b_msg_arr_changed
=
YES
;
b_msg_arr_changed
=
YES
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment