avformat/oggparseopus: factor opus_duration() out

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 39d11d599cd292485fe991cd22e10d7a1738b3bc)
avformat/oggparseopus: calculate pts/dts for initial packets after seeking

based on code from oggparsevorbis
Fixes Ticket3124
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7f39352a1b661771cf471986059027acd8e0e31f)

Fixes ticket #3943.
avformat/oggparseopus: Check opus_duration() return value

Regression since 39d11d599cd292485fe991cd22e10d7a1738b3bc

os->pduration would be wrongly assigned a negative value on invalid packets
instead of aborting.

Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c619e14c314b44d86a8d552259afb957c0b6775d)