Error: avcodec_init(); - init

I'll try to compile under Ubuntu 14.04.2 and I get the following error:
VideoPlayerPipHd.c: In static member function ‘static void reel::VideoPlayerPipHd::Create()’:
VideoPlayerPipHd.c:792:6: error: ‘avcodec_init’ was not declared in this scope
avcodec_init -> avcodec_register_all;
^
VideoPlayerPipHd.c:793:7: error: ‘av_open_input_file’ was not declared in this scope
av_open_input_file -> avformat_open_input;
^
The code is:
787 void VideoPlayerPipHd::Create()
788 {
789 if (!instance_)
790 {
791 instance_ = new VideoPlayerPipHd;
792 avcodec_init();
793 avcodec_register_all();
794 }
795 }
I tried several things but I am stuck. Could somebody help me please?
Thanks in advance

The answer is that the ffmpeg functions are deprecated. See the list here for example:
https://www.ffmpeg.org/doxygen/0.8/deprecated.html
For example change av_open_input_file to avformat_open_input.

Related

BPF Ring Buffer Invalid Argument (-22)?

I wanted to use eBPF's latest map, BPF_MAP_TYPE_RINGBUF, but I can't find much information online on how I can use it, so I am just doing some trial-and-error here. I defined and used it like this:
struct bpf_map_def SEC("maps") r_buf = {
.type = BPF_MAP_TYPE_RINGBUF,
.max_entries = 1 << 2,
};
SEC("lsm/task_alloc")
int BPF_PROG(task_alloc, struct task_struct *task, unsigned long clone_flags) {
uint32_t pid = task->pid;
bpf_ringbuf_output(&r_buf, &pid, sizeof(uint32_t), 0); //stores the pid value to the ring buffer
return 0;
}
But I got the following error when running:
libbpf: map 'r_buf': failed to create: Invalid argument(-22)
libbpf: failed to load object 'bpf_example_kern'
libbpf: failed to load BPF skeleton 'bpf_example_kern': -22
It seems like libbpf does not recognize BPF_MAP_TYPE_RINGBUF? I cloned the latest libbpf from GitHub and did make and make install. I am using Linux 5.8.0 kernel.
UPDATE: The issue seems to be resolved if I changed the max_entries to something like 4096 * 64, but I don't know why this is the case.
You are right, the problem is in the size of BPF_MAP_TYPE_RINGBUF (max_entries attribute in libbpf map definition). It has to be a multiple of a memory page (which is 4096 bytes at least on most popular platforms). So that explains why it all worked when you specified 64 * 4096.
BTW, if you'd like to see some examples of using it, I'd start with BPF selftests:
user-space part: https://github.com/torvalds/linux/blob/master/tools/testing/selftests/bpf/prog_tests/ringbuf.c
kernel (BPF) part: https://github.com/torvalds/linux/blob/master/tools/testing/selftests/bpf/progs/test_ringbuf.c

[zetapush]Error in macro: code=SUB_ASSIGN - Message = Assignment failed

When calling a macro I have the following error in response:
code=SUB_ASSIGN
Message = Assignment failed
Location= Reduce at line 65 of file mymacro.zms
the line 65 is
/** Reduce */
var b = gda(GDA).reduce {
table: 'myTable',
start: __parameters.key + '##',
stop: __parameters.key + '##a',
page: {
pageNumber: 0,
pageSize: 100000000
},
initialValue: {
tR: tR,
count: 0
},
'columns': ['col1', 'col2'],
'function': usr:myfunc
};
Seen on Android SDK (not on JS SDK) and not 100% reproducible.
What's the meaning of this error and how can I correct it?
Thanks.
The (poorly documented) meaning of SUB_ASSIGN is that an assignment with a syntax like a.b.c = d; has failed.
More precisely, the left hand operand is made of several hierarchical sub-parts (in my example a, b, and c).
Note that SUB_ASSIGN reports a programming error, which you should guard against :
when assigning a.b.c, at least a.b must exist and be not null.
A code pattern such as this one should do the trick:
// the ?? operator returns true when an expression is defined and not null
if (! a.b ??) {
a.b = {};
}
...
a.b.c = 0;
or, shorter, if applicable :
if (! a.b ??) {
a.b = {c:0};
}
The relevant documentation for '??' can be found in the official API reference documentation
As your code does not include such a statement anyway, I suppose that the actual error does not lie in your reduce call, but inside your callback function (usr:myfunc).
Moreover, to ease further debugging :
the error report you gave does not seem to contain the full stack trace up to the callback of the 'reduce' call. This might very well be a missing/not-yet-implemented feature of the zetapush API (which you could request...).

iOS JavascriptCore exception detailed stacktrace info

It seems the exception stacktrace in iOS only contains the method name or there is a bug. Below is my code of handling exceptions in JSContext.
context.exceptionHandler = { (ctx: JSContext!, value: JSValue!) in
// type of String
let stacktrace = value.objectForKeyedSubscript("stack").toString()
// type of Number
let lineNumber = value.objectForKeyedSubscript("line")
// type of Number
let column = value.objectForKeyedSubscript("column")
let moreInfo = "in method \(stacktrace)Line number in file: \(lineNumber), column: \(column)"
Logger.error("JS ERROR: \(value) \(moreInfo)")
}
And I got logs like below
ERROR : JSContextRenderer.swift:308 : setupContext : JS ERROR: Error in method clearBackground
Line number in file: 162, column: 12"
Note there is a new line right after the "clearBackground" name, I think there probably more information there.
Can anybody having similar experience confirm? Any help is appreciated. Thanks.
Looks like it does show more information in the stack. Here is one of the log information I got:
JS ERROR: TypeError: undefined is not a function (evaluating 'msg.__assert__()') in method assert
syncShots
updateSync
initSync
setState
onLogicStateChanged
onLogicStateChanged
[native code]
updateMove
sendMove
shoot
onTouchUp
[native code]
_handleEvent
_dispatchEvent
. Line number in file: 183, column: 20
Long ago, #igrek asked where the keys in value come from. They're part of the Error object that was thrown by the JavaScript engine, and that now appears as value in the native error handler callback. What exactly Error includes depends on the implementation, but typically includes message, fileName, and lineNumber. It appears that stack is also supported. More details on the MDN page for Error .

Coffeescript undefined variable

I have the following coffeescript:
$("#complete").click ->
bootbox.dialog "Remember, if you complete the workorder you won't be able to add labor and materials.", [
label: "Complete"
class: "btn-success"
callback: ->
$("td").filter(':contains("ID:")').each ->
woid = $(this).nextAll().text()
$.update "/workorders/" + woid,
workorder:
wostatus_id: 232
,
label: "Cancel"
class: "btn-danger"
callback: ->
return 'false'
]
When it runs, I get this in the browser console:
Uncaught ReferenceError: woid is not defined
Thanks for the help!
Variables are scoped to the function where you first assign to them. To make woid available, initialize it to null outside your filter callback:
woid = null
$("td").filter(':contains("ID:")').each ->
woid = $(this).nextAll().text()
$.update "/workorders/" + woid,
workorder:
wostatus_id: 232
And as always, check your compiled JavaScript when debugging. The answer will usually be quite obvious.

Errors in my code

Alright, I have a couple error messages and I am stuck. Just seeing if anybody could help me out here, it would be greatly appreciated.
Here is the error message:
bibleajax.cpp: In function âint main():
bibleajax.cpp:92: error: no matching function for call to Bible::lookup(Verse&, LookupResult&)
Bible.h:32: note: candidates are: const Verse Bible::lookup(Ref, LookupResult&)
make: * [bibleajax.o] Error 1
Here is line 92:
Ref nRef;
Verse nVerse;
for (int t = 0; t < num; t++){
do {
nRef = kjv.lookup(nVerse, result);
nVerse = kjv.lookup(nRef, result);
}
while (result != ch && result != no_chapter);
It would appear that your Verse class does not have a member function called getRef(). You also appear to be trying to call the lookup function by passing it a Verse object instead of a Ref object... but that piece of code doesn't seem to be included in what you've posted here.
Note that the relevant line numbers for the code are posted in the error messages. So check lines 79 and 92 for the issues I mentioned here.