api_idnode_load
( access_t *perm, void *opaque, const char *op, htsmsg_t *args, htsmsg_t **resp )
{
- int err = 0, meta = 0, count = 0;
+ int err = 0, meta, count = 0;
idnode_t *in;
htsmsg_t *uuids, *l = NULL, *m;
htsmsg_t *flist;
if (!(uuids = htsmsg_field_get_list(f)))
if (!(uuid = htsmsg_field_get_str(f)))
return EINVAL;
- htsmsg_get_s32(args, "meta", &meta);
+ meta = htsmsg_get_s32_or_default(args, "meta", 0);
flist = api_idnode_flist_conf(args, "list");
} else {
ret = 0;
}
- if(ret) {
- tvhlog(LOG_ERR, "epgdb", "failed to store epg to disk");
- close(fd);
- hts_settings_remove("epgdb.v%d", EPG_DB_VERSION);
- }
return ret;
}
return;
memset(&stats, 0, sizeof(stats));
- if ( _epg_write_sect(fd, "config") ) goto fin;
- if (_epg_write(fd, epg_config_serialize())) goto fin;
- if ( _epg_write_sect(fd, "brands") ) goto fin;
+ if ( _epg_write_sect(fd, "config") ) goto error;
+ if (_epg_write(fd, epg_config_serialize())) goto error;
+ if ( _epg_write_sect(fd, "brands") ) goto error;
RB_FOREACH(eo, &epg_brands, uri_link) {
- if (_epg_write(fd, epg_brand_serialize((epg_brand_t*)eo))) goto fin;
+ if (_epg_write(fd, epg_brand_serialize((epg_brand_t*)eo))) goto error;
stats.brands.total++;
}
- if ( _epg_write_sect(fd, "seasons") ) goto fin;
+ if ( _epg_write_sect(fd, "seasons") ) goto error;
RB_FOREACH(eo, &epg_seasons, uri_link) {
- if (_epg_write(fd, epg_season_serialize((epg_season_t*)eo))) goto fin;
+ if (_epg_write(fd, epg_season_serialize((epg_season_t*)eo))) goto error;
stats.seasons.total++;
}
- if ( _epg_write_sect(fd, "episodes") ) goto fin;
+ if ( _epg_write_sect(fd, "episodes") ) goto error;
RB_FOREACH(eo, &epg_episodes, uri_link) {
- if (_epg_write(fd, epg_episode_serialize((epg_episode_t*)eo))) goto fin;
+ if (_epg_write(fd, epg_episode_serialize((epg_episode_t*)eo))) goto error;
stats.episodes.total++;
}
- if ( _epg_write_sect(fd, "serieslinks") ) goto fin;
+ if ( _epg_write_sect(fd, "serieslinks") ) goto error;
RB_FOREACH(eo, &epg_serieslinks, uri_link) {
- if (_epg_write(fd, epg_serieslink_serialize((epg_serieslink_t*)eo))) goto fin;
+ if (_epg_write(fd, epg_serieslink_serialize((epg_serieslink_t*)eo))) goto error;
stats.seasons.total++;
}
- if ( _epg_write_sect(fd, "broadcasts") ) goto fin;
+ if ( _epg_write_sect(fd, "broadcasts") ) goto error;
CHANNEL_FOREACH(ch) {
RB_FOREACH(ebc, &ch->ch_epg_schedule, sched_link) {
- if (_epg_write(fd, epg_broadcast_serialize(ebc))) goto fin;
+ if (_epg_write(fd, epg_broadcast_serialize(ebc))) goto error;
stats.broadcasts.total++;
}
}
+ close(fd);
/* Stats */
tvhlog(LOG_INFO, "epgdb", "saved");
tvhlog(LOG_INFO, "epgdb", " episodes %d", stats.episodes.total);
tvhlog(LOG_INFO, "epgdb", " broadcasts %d", stats.broadcasts.total);
-fin:
+ return;
+
+error:
+ tvhlog(LOG_ERR, "epgdb", "failed to store epg to disk");
+ hts_settings_remove("epgdb.v%d", EPG_DB_VERSION);
close(fd);
}
AVCodec *icodec, *ocodec;
AVCodecContext *ictx, *octx;
AVDictionary *opts;
- AVPacket packet;
+ AVPacket packet, packet2;
AVPicture deint_pic;
- uint8_t *buf, *out, *deint;
- int length, len, got_picture;
+ uint8_t *buf, *deint;
+ int length, len, ret, got_picture, got_output;
video_stream_t *vs = (video_stream_t*)ts;
ictx = vs->vid_ictx;
icodec = vs->vid_icodec;
ocodec = vs->vid_ocodec;
- buf = out = deint = NULL;
+ buf = deint = NULL;
opts = NULL;
if (ictx->codec_id == AV_CODEC_ID_NONE) {
else if (ictx->coded_frame && ictx->coded_frame->pts != AV_NOPTS_VALUE)
vs->vid_enc_frame->pts = vs->vid_dec_frame->pts;
- AVPacket packet2;
- int ret, got_output;
av_init_packet(&packet2);
packet2.data = NULL; // packet data will be allocated by the encoder
if(buf)
av_free(buf);
- if(out)
- av_free(out);
-
if(deint)
av_free(deint);