New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added edl/comskip support over HTSP. #284
Conversation
|
@kendrak24 some minor points:
I'd generally like to see very little code in HTSP for supporting this. Move all the file processing etc.. out to a file in the dvr/ directory. Have some API like: dvr_cutpoint_list_t *dvr_get_cutlist ( u32 id ); i.e. it takes the DVR entry ID and returns a list of cut points. With a structures something like: typedef struct dvr_cutpoint { typedef LIST_HEAD(,dvr_cutpoint) dvr_cutpoint_list_t; |
|
For point 3, what do you suggest? Allocating dynamically and passing pointers, or using lists, or what? |
|
@kendrak24 I would probably be more dynamic (lists) generally, but that can wait, as long as the HTSP API (and code) are clean I'll be happy at this stage. But I was more specifically referring to including the constant array lengths in the function params, just pass ** and assume fixed length (if that's what's always defined). Yes strictly you lose some compiler checking, but the code doesn't look so messy. And better still just have a char **, where the last entry is a NULL (to detect end of the list). But sort out the HTSP stuff first and get the code cleaned up. |
|
OK, code cleaned up a bit. Moved processing out of htsp to new file under dvr as suggested. |
| * id u32 required DVR entry id | ||
| * | ||
| * Result message fields: | ||
| * hasCuts u32 required 1 if there is any cutpoint data. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drop this field, you can infer it from the presence (or not) of cutpoints.
|
@kendrak24 I definitely want to get this included. but have lost track of where things were. I'm sorry its taken so long to get back to master dev. But I will try and review this one later this week. |
|
@adamsutton OK. Let me know if there's anything I need to do. |
|
@adamsutton Any estimate when this might be included? |
|
@kendrak24 really, sorry I've been so snowed under, but I'm going to review it now... |
|
or tomorrow, promise. But I've skimmed it and ti looks good, my main concern is the HTSP stuff, since once we do that we kinda have to stick to it. And I'm happy with that. I don't really care that much about the EDL parsing bit, but I do just want to give it a quick scan for obvious errors before I merge. |
| if(!dvr_switch_file_extension(de->de_filename, ".txt", dc_filename)) | ||
| return NULL; | ||
|
|
||
| dvr_cutpoint_list_t *cuts = calloc(1, sizeof(dvr_cutpoint_list_t)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this leaks on error below. Might also be better to have some sort of table driven approach to parsing:
static struct {
const char *ext;
void parse ( const char *path, cut_list_t *cuts );
} cut_parsers[] = {
{ .ext = ".edl". .parse = dvr_parse_edl },
{ .ext = ".txt". .parse = dvr_parse_comskip },
}
And just iterate over that list etc... That way adding a new parser for a new format will be a bit simpler. Needs some slight logic change and possibly simplification of the extension setup might be good.
Anyway that's just a thought
|
|
||
| cutpoint = calloc(1, sizeof(dvr_cutpoint_t)); | ||
| if(cutpoint == NULL) | ||
| return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
leak's the file descriptor, this sort of error is usually terminal anyway. but better to clean up and return error.
|
@kendrak24 lots of comments, it's a nice feature, pretty good code, so I was probably more picky than usual. But would like to see at least the style and memleaks fixed. Changing to table driven parsers would be a nice to have. |
|
@kendrak24 an progress on this? I would like to include as I think there are plenty of people that will benefit from this. |
|
@adamsutton Yep, working on it. It'll probably be ready later today. Minus the table driven approach. |
|
@kendrak24 can you rebase this to clean it up. I want to make a few changes before merge, but need to get out my laptop for that, so will do later. |
|
Rebased and comments squashed. |
|
@kendrak24 can you check the following branch https://github.com/tvheadend/tvheadend/tree/feature/dvr-cutpoint. I reworked the code a bit, can you check it still works and if you could fix any stupid mistakes I'd appreciate that! |
|
@adamsutton Will try to check it tonight! |
|
@adamsutton Sorry for this crude diff, but I didn't find a way to comment directly in your branch. Found a couple of things, diff below comments.
After these changes it worked fine with a comskip file for me. |
The possibility to skip commercials when streaming a recording over htsp (e.g. from XBMC) has been missing, but now that XBMC (Gotham) supports it, I've added the necessary htsp API changes. It supports two formats of commercial skip data: Comskip and EDL, in that priority order. The code first checks for the presence of a comskip file, and if that isn't found it looks for an edl file. I've tested this first on a modified 3.2 clone, and now on master.
To use it with XBMC the addon needs to implement the GetRecordingEdl method. I've forked the opdenkapm/xbmc.pvr-addons addon repo to https://github.com/kendrak24/xbmc-pvr-addons (branch hts.pvr_edl) and implemented it there.
This is the first github thing I've done, so I hope everything is correct. Let me know if there is something I need to change...