av.bytesource.Bytesource object has no attribute 'size' Error while adding extradata manually.
Created by: choinw
HI.
I'm trying to decode h.264 raw stream without PPS SPS.
For encoding parameters, some extradata is being delivered from another session.
But while trying to add extradata bytes manually, the script returns the error below.
line 392, in initialize_ffmpeg_video av_codec_ctx.extradata = extradata File "av/codec/context.pyx", line 103, in av.codec.context.CodecContext.extradata.set AttributeError: 'av.bytesource.ByteSource' object has no attribute 'size'
this code block in av/codec/context.pyx causes the issue.
I have changed the line that is allocating extradata_size to
self.ptr.extradata_size = len(data)
then, it works.
in bytesource.pyx, there is no attribute 'size' for bytesource object.
The original commit from issue #287 by @adavoudi includes the working code. (commit 51a73857 on 25 Feb)
def __set__(self, data):
buffer_size = len(data)
cdef ByteSource source = bytesource(data)
self.ptr.extradata = <uint8_t *>malloc(buffer_size * sizeof(uint8_t))
self.ptr.extradata_size = buffer_size
memcpy(self.ptr.extradata, source.ptr, buffer_size)
but it has been changed in merged commit 4b01b63b on 23 Mar.
please check it out.
Thanks.