TS duration is always 0 if use libvlc_new_media_callbacks

This forum is about all development around libVLC.
someusername
New Cone
New Cone
Posts: 7
Joined: 31 Oct 2019 18:04

TS duration is always 0 if use libvlc_new_media_callbacks

Postby someusername » 14 Apr 2021 12:59

Hi! I would like to know if this is a bug or by design.
libvlc_new_media_callbacks:
TS duration - 0 (why?)
mp4 duration - perfectly
mkv duration - perfectly
avi duration - perfectly

libvlc_media_new_path, libvlc_media_new_fd:
TS duration - perfectly
mp4 duration - perfectly
mkv duration - perfectly
avi duration - perfectly

I only use libvlc_new_media_callbacks for local files.

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: TS duration is always 0 if use libvlc_new_media_callbacks

Postby Rémi Denis-Courmont » 14 Apr 2021 16:36

TS duration is just a rough estimate from file size. Using callbacks, the file size is unknown.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

someusername
New Cone
New Cone
Posts: 7
Joined: 31 Oct 2019 18:04

Re: TS duration is always 0 if use libvlc_new_media_callbacks

Postby someusername » 14 Apr 2021 21:27

TS duration is just a rough estimate from file size. Using callbacks, the file size is unknown.
but

Code: Select all

libvlc_media_t* libvlc_media_new_callbacks ( libvlc_instance_t * instance, libvlc_media_open_cb open_cb, //<-- libvlc_media_read_cb read_cb, libvlc_media_seek_cb seek_cb, libvlc_media_close_cb close_cb, void * opaque )
libvlc_media_open_cb
int(* libvlc_media_open_cb) (void *opaque, void **datap, uint64_t *sizep)
sizep byte length of the bitstream or UINT64_MAX if unknown [OUT]

the file size is known. I assign it to the *sizep argument

User avatar
InTheWings
Developer
Developer
Posts: 1275
Joined: 07 Aug 2013 13:15
VLC version: crashing
Operating System: Linux
Contact:

Re: TS duration is always 0 if use libvlc_new_media_callbacks

Postby InTheWings » 15 Apr 2021 10:37

TS need to read some data from start and from end. There's no stored information like MP4 or MKV.
Unsure if the callbacks can provide that.
:!: If you want your problem to be solved :
* First read troubleshooting guide VSG:Main
* Always provide verbose LOGS ! (command line or from gui)
* Always check your issue against a developer build from Nightly Build of VLC
* Tell us when your problem is solved !

someusername
New Cone
New Cone
Posts: 7
Joined: 31 Oct 2019 18:04

Re: TS duration is always 0 if use libvlc_new_media_callbacks

Postby someusername » 16 Apr 2021 01:20

TS need to read some data from start and from end. There's no stored information like MP4 or MKV.
Yes, that is right. In my implementation, libvlc_new_media_callbacks has direct access to the file and should also find the duration quickly as if I were opening the file using the path.
I tried to find the code where this condition (pseudocode: IF file is mpeg-ts and used libvlc_new_media_callbacks THEN duration = 0) is, but with no success so far.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 27 guests