diff options
-rw-r--r-- | HISTORY | 13 | ||||
-rw-r--r-- | README | 7 | ||||
-rw-r--r-- | audiorecorder.c | 2 | ||||
-rw-r--r-- | browse-item.c | 22 | ||||
-rw-r--r-- | browse-item.h | 10 | ||||
-rw-r--r-- | browse.c | 242 | ||||
-rw-r--r-- | convert.c | 9 | ||||
-rw-r--r-- | rds.c | 117 | ||||
-rw-r--r-- | rds.h | 6 | ||||
-rw-r--r-- | recstat.h | 2 | ||||
-rw-r--r-- | setup.c | 4 | ||||
-rw-r--r-- | setup.h | 4 | ||||
-rw-r--r-- | trackinfo.c | 16 | ||||
-rw-r--r-- | xml-base.c | 4 | ||||
-rw-r--r-- | xml-base.h | 4 | ||||
-rw-r--r-- | xml-cache.c | 12 | ||||
-rw-r--r-- | xml-cache.h | 2 |
17 files changed, 244 insertions, 232 deletions
@@ -88,3 +88,16 @@ VDR Plugin 'audiorecorder' Revision History - channel (#5) and event (#6) added to the parameter list of the external script, bitrates are now given correctly. +2014-04-19: +- moved to http://projects.vdr-developer.org/ +- new Projectmanager Joerg Bornkessel <hd_brummy at gento.org> + +2014-05-05: Version 2.0.0_rc2 +- new Makefile, up from vdr-2.0 (support for old Makefile handling droped) +- unbundle included tinyxml code, using the shared lib from tinyxml (with stl) +- droped obsolete i18n language handling +- several fixex for ffmpeg/libav-9 + +2014-05-31: Version 2.0.0_rc3 +- #bug 1846, missing parameter LiveView added +- compile fixed with ffmpeg-2 @@ -1,10 +1,11 @@ This is a "plugin" for the Video Disk Recorder (VDR). -Written by: herbert attenberger <herbsl at a-land.de> +Written by: herbert attenberger <herbsl at a-land.de> (Retired) + Joerg Bornkessel <hd_brummy at gentoo.org> (Projectmanagment) -Project's homepage: <http://www.a-land.de> +Project's homepage: <http://projects.vdr-developer.org/projects/plg-audiorecorder> -Latest version available at: <http://www.a-land.de> +Latest version available at: <http://projects.vdr-developer.org/projects/plg-audiorecorder> See the file COPYING for license information. diff --git a/audiorecorder.c b/audiorecorder.c index 58284ec..8775af0 100644 --- a/audiorecorder.c +++ b/audiorecorder.c @@ -35,7 +35,7 @@ using namespace std; /* --- cPluginAudiorecorder ------------------------------------------------- */ const char *cPluginAudiorecorder::DESCRIPTION = tr("floods your disc with music"); -const char *cPluginAudiorecorder::VERSION = "2.0.0_pre1"; +const char *cPluginAudiorecorder::VERSION = "2.0.0_rc4"; string cPluginAudiorecorder::recdir; int cPluginAudiorecorder::debug = 0; diff --git a/browse-item.c b/browse-item.c index 5b59923..7912662 100644 --- a/browse-item.c +++ b/browse-item.c @@ -18,11 +18,11 @@ cBrowseItem::cBrowseItem(cBrowseItem *_main_item, const cTrackInfo *_track, main_item = _main_item; if (main_item) main_item->increase_items(); - + track = _track; column = _column; type = _type; - + items = 0; } @@ -30,7 +30,7 @@ cBrowseItem::cBrowseItem(cBrowseItem *_main_item, const cTrackInfo *_track, void cBrowseItem::increase_items(void) { ++items; - + if (main_item) main_item->increase_items(); } @@ -39,10 +39,10 @@ void cBrowseItem::increase_items(void) void cBrowseItem::delete_items(int del_items) { items -= del_items; - + if (main_item) main_item->delete_items(del_items); - + if (items < 0) items = 0; } @@ -50,20 +50,20 @@ void cBrowseItem::delete_items(int del_items) void cBrowseItem::toggle_node(void) { - string txt = Text(); - + string txt = Text(); + if (type == itemNodeOpen) { type = itemNodeClose; string::size_type f = txt.find_first_of("-"); if (f != string::npos) txt.replace(f, 1, "+"); - } + } else if (type == itemNodeClose) { type = itemNodeOpen; string::size_type f = txt.find_first_of("+"); if (f != string::npos) txt.replace(f, 1, "-"); - } - - SetText(txt.c_str()); + } + + SetText(txt.c_str()); } diff --git a/browse-item.h b/browse-item.h index 9da3452..a89d1f7 100644 --- a/browse-item.h +++ b/browse-item.h @@ -21,21 +21,21 @@ private: const cTrackInfo *track; cBrowseItem *main_item; int column; - eItemType type; + eItemType type; int items; public: cBrowseItem(cBrowseItem *_main_item, const cTrackInfo *_track, int _column, eItemType _type); - + void increase_items(void); void delete_items(int del_items); void toggle_node(void); - + const cTrackInfo *get_track(void) const { return track; } - const cBrowseItem *get_main_item(void) const { return main_item; } + const cBrowseItem *get_main_item(void) const { return main_item; } int get_column(void) const { return column; } int get_items(void) const { return items; } - + bool is_node(void) const { return (type != itemTrack); } bool is_open(void) const { return (type == itemNodeOpen); } bool is_closed(void) const { return (type == itemNodeClose); } @@ -26,11 +26,11 @@ using namespace std; cBrowse::cBrowse(void) :cOsdMenu("") { - num_columns = MAXCOLS; - columns = NULL; - columns = new cColumn[num_columns + 1]; + num_columns = MAXCOLS; + columns = NULL; + columns = new cColumn[num_columns + 1]; - player = cPluginManager::CallFirstService(SERVICE); + player = cPluginManager::CallFirstService(SERVICE); string skin = Skins.Current()->Name(); width = DisplayMenu()->EditableWidth(); @@ -38,7 +38,7 @@ cBrowse::cBrowse(void) if (skin != "curses") width /= 12; - dsyslog("[audiorecorder]: skin %s (width %d) detected (%s, %s())", + dsyslog("[audiorecorder]: skin %s (width %d) detected (%s, %s())", skin.c_str(), width, __FILE__, __func__); set_view(SetupValues.default_view); @@ -47,31 +47,31 @@ cBrowse::cBrowse(void) cBrowse::~cBrowse() { - delete[] columns; + delete[] columns; } eOSState cBrowse::ProcessKey(eKeys key) { - eOSState state = cOsdMenu::ProcessKey(key); + eOSState state = cOsdMenu::ProcessKey(key); if (HasSubMenu()) { - process_submenu_states(state); + process_submenu_states(state); if (state == osBack || key == kBlue || key == kOk) CloseSubMenu(); - return osContinue; + return osContinue; } set_status(); set_help_keys(); - cBrowseItem *item = get_actual_item(); + cBrowseItem *item = get_actual_item(); - switch (key) { + switch (key) { case kRed: - if (! item) + if (! item) break; if (item->is_node()) @@ -82,26 +82,26 @@ eOSState cBrowse::ProcessKey(eKeys key) get_trackname(item->get_track()))); break; - case kGreen: - if (help_green.empty()) - break; + case kGreen: + if (help_green.empty()) + break; - expand ? expand = false : expand = true; - set_view(view, false); + expand ? expand = false : expand = true; + set_view(view, false); - break; + break; case kYellow: set_view(++view); break; - case kBlue: + case kBlue: if (item && ! item->is_node()) AddSubMenu(new cBrowseInfo(item->get_track())); break; - case kOk: - if (! item) - break; + case kOk: + if (! item) + break; if (! item->is_node()) play_file(item->get_track()); @@ -109,16 +109,16 @@ eOSState cBrowse::ProcessKey(eKeys key) item->toggle_node(); insert_items(); } - else { + else { item->toggle_node(); delete_items(); } - break; - default: - break; - } + break; + default: + break; + } - return state; + return state; } @@ -134,8 +134,8 @@ void cBrowse::set_view(int _view, bool init) columns[1].set(colTitle, width - TAB_LEN); columns[2].set(colEnd); - if (init) - expand = false; + if (init) + expand = false; help_yellow = views[2]; } @@ -148,8 +148,8 @@ void cBrowse::set_view(int _view, bool init) columns[2].set(colArtistTitle, width - 2 * TAB_LEN); columns[3].set(colEnd); - if (init) - expand = false; + if (init) + expand = false; help_yellow = views[3]; } @@ -163,8 +163,8 @@ void cBrowse::set_view(int _view, bool init) columns[3].set(colArtistTitle, width - TAB_LEN - 17); columns[4].set(colEnd); - if (init) - expand = true; + if (init) + expand = true; help_yellow = views[0]; } @@ -176,43 +176,43 @@ void cBrowse::set_view(int _view, bool init) columns[0].set(colArtistTitle, width); columns[1].set(colEnd); - if (init) - expand = true; + if (init) + expand = true; help_yellow = views[1]; } - if (init) { - SetCols(columns[0].get_width(), columns[1].get_width(), - columns[2].get_width(), columns[3].get_width(), - columns[4].get_width()); + if (init) { + SetCols(columns[0].get_width(), columns[1].get_width(), + columns[2].get_width(), columns[3].get_width(), + columns[4].get_width()); - Cache.sort(columns); - } + Cache.sort(columns); + } Clear(); insert_items(); set_status(); - set_help_keys(); + set_help_keys(); set_title(); } void cBrowse::set_help_keys(void) { - /* green key */ - if (view == 0) - help_green.erase(); - else if (expand) + /* green key */ + if (view == 0) + help_green.erase(); + else if (expand) help_green = tr("collapse all"); - else + else help_green = tr("expand all"); cBrowseItem *item = get_actual_item(); SetHelp(tr("action"), (help_green.empty() ? NULL : help_green.c_str()) , - help_yellow, (item && ! item->is_node() ? "info" : NULL)); + help_yellow, (item && ! item->is_node() ? "info" : NULL)); } @@ -222,17 +222,17 @@ void cBrowse::set_status(void) if (strcmp(Skins.Current()->Name(), "sttng") == 0) return; - string status(views[view]); + string status(views[view]); - cBrowseItem *item = get_actual_item(); + cBrowseItem *item = get_actual_item(); - if (item && item->get_main_item()) { + if (item && item->get_main_item()) { status.append(" "); - status.append(get_category(item)); + status.append(get_category(item)); } cut_string(status, width); - SetStatus(status.c_str()); + SetStatus(status.c_str()); } @@ -248,33 +248,33 @@ void cBrowse::set_title(void) void cBrowse::process_submenu_states(eOSState &state) { - cBrowseItem *item = get_actual_item(); + cBrowseItem *item = get_actual_item(); - switch(state) { - case osUser1: - play_all_files(item); - state = osBack; + switch(state) { + case osUser1: + play_all_files(item); + state = osBack; - break; - case osUser6: - if (item) - play_file(item->get_track()); + break; + case osUser6: + if (item) + play_file(item->get_track()); - state = osBack; + state = osBack; - break; - default: - break; - } + break; + default: + break; + } } cBrowseItem *cBrowse::get_actual_item(void) { - if (Current() < 0) - return NULL; + if (Current() < 0) + return NULL; - return (cBrowseItem *)Get(Current()); + return (cBrowseItem *)Get(Current()); } @@ -288,22 +288,22 @@ void cBrowse::insert_items(void) columns[c].del_last_entry(); } - int column = 0; - cBrowseItem *item = get_actual_item(); + int column = 0; + cBrowseItem *item = get_actual_item(); if (item && item->is_node()) { - set_filter(item); + set_filter(item); column = item->get_column(); columns[column].set_main_item(item); ++column; } - int depth; - if (expand) - depth = num_columns; - else - depth = column + 1; + int depth; + if (expand) + depth = num_columns; + else + depth = column + 1; - for (const cTrackInfo *track = Cache.get_next_track(true); track; + for (const cTrackInfo *track = Cache.get_next_track(true); track; track = Cache.get_next_track()) { if (filter_track(track)) @@ -316,14 +316,14 @@ void cBrowse::insert_items(void) if (c == num_columns - 1) type = itemTrack; - else if (expand) - type = itemNodeOpen; - else - type = itemNodeClose; + else if (expand) + type = itemNodeOpen; + else + type = itemNodeClose; - /* don't show double nodes: */ + /* don't show double nodes: */ if (type != itemTrack && - entry == columns[c].get_last_entry()) + entry == columns[c].get_last_entry()) continue; columns[c].set_last_entry(entry); @@ -348,7 +348,7 @@ void cBrowse::insert_items(void) Add(item, true, Get(Current())); } - } + } SetCurrent(Get(pos)); Display(); @@ -357,9 +357,9 @@ void cBrowse::insert_items(void) void cBrowse::delete_items(void) { - cBrowseItem *item = get_actual_item(); - if (! item || ! item->is_node()) - return; + cBrowseItem *item = get_actual_item(); + if (! item || ! item->is_node()) + return; for (int c = 0; c < item->get_items(); ++c) Del(Current() + 1); @@ -399,7 +399,7 @@ bool cBrowse::filter_track(const cTrackInfo *track) string cBrowse::get_category(const cBrowseItem *item) { - string category(""); + string category(""); if (item) { int columns = item->get_column(); @@ -416,7 +416,7 @@ string cBrowse::get_category(const cBrowseItem *item) } } - return category; + return category; } @@ -452,7 +452,7 @@ string cBrowse::get_value_of_column(const cTrackInfo *track, int c) case colArtistTitle: col_tmp << track->get_artist() << " - " << track->get_title(); - break; + break; case colAlbum: col_tmp << track->get_album(); break; @@ -486,7 +486,7 @@ string cBrowse::get_value_of_column(const cTrackInfo *track, int c) string col(col_tmp.str()); - if (columns[c].get_cut()) + if (columns[c].get_cut()) cut_string(col, columns[c].get_width() - 1); value.append(col); @@ -504,50 +504,50 @@ string cBrowse::get_value_of_column(const cTrackInfo *track, int c) void cBrowse::play_all_files(const cBrowseItem *node) { - if (! player) { + if (! player) { Skins.Message(mtError, tr("No external player-plugin found"), 2); - return; + return; } - if (! node || ! node->is_node()) - return; + if (! node || ! node->is_node()) + return; - set_filter(node); + set_filter(node); string status = tr("Playing all tracks in "); status.append(get_category(node)); cut_string(status, width); SetStatus(status.c_str()); - for (const cTrackInfo *track = Cache.get_next_track(true); track; + for (const cTrackInfo *track = Cache.get_next_track(true); track; track = Cache.get_next_track()) { if (! filter_track(track)) play_file(track, false); - } + } } void cBrowse::play_file(const cTrackInfo *track, bool set_status) { - if (! player) { + if (! player) { Skins.Message(mtError, tr("No external player-plugin found"), 2); - return; + return; } - MP3ServiceData data; - data.data.filename = track->get_path().c_str(); - data.result = 0; + MP3ServiceData data; + data.data.filename = track->get_path().c_str(); + data.result = 0; #ifndef AUDIORECORDER_DEVEL - player->Service(SERVICE, &data); + player->Service(SERVICE, &data); - if (data.result == 0) { - dsyslog("[audiorecorder]: plugin %s could not play the file " - "%s (%s, %s())", player->Name(), - track->get_path().c_str(), __FILE__, __func__); + if (data.result == 0) { + dsyslog("[audiorecorder]: plugin %s could not play the file " + "%s (%s, %s())", player->Name(), + track->get_path().c_str(), __FILE__, __func__); return; - } + } #endif /* AUDIORECORDER_DEVEL */ if (set_status) { @@ -597,8 +597,8 @@ cBrowseAction::cBrowseAction(bool node, const string &text) cBrowseInfo::cBrowseInfo(const cTrackInfo *track) :cOsdMenu(tr("Audiorecorder, Info"), 11) { - string path = track->get_path(); - path.erase(0, cPluginAudiorecorder::get_recdir().length()); + string path = track->get_path(); + path.erase(0, cPluginAudiorecorder::get_recdir().length()); Add(add_item(tr("File"), path)); Add(add_item(tr("Artist"), track->get_artist())); @@ -606,7 +606,7 @@ cBrowseInfo::cBrowseInfo(const cTrackInfo *track) Add(add_item(tr("Album"), track->get_album())); Add(add_item(tr("Genre"), track->get_genre())); - stringstream tmp; + stringstream tmp; tmp << track->get_track(); Add(add_item(tr("Track"), tmp.str())); @@ -626,13 +626,13 @@ cBrowseInfo::cBrowseInfo(const cTrackInfo *track) cOsdItem *cBrowseInfo::add_item(const char *type, const string &text) { - string txt = type; - txt.append(":\t"); + string txt = type; + txt.append(":\t"); - if (text.empty() || text == "0") + if (text.empty() || text == "0") txt.append(tr("unknown")); - else - txt.append(text); + else + txt.append(text); - return new cOsdItem(txt.c_str(), osUnknown, false); + return new cOsdItem(txt.c_str(), osUnknown, false); } @@ -73,6 +73,7 @@ void cConvert::init_decoder(void) void cConvert::init_encoder(const char *codec, int bit_rate, int sample_rate, int channels) { + avcodec_register_all(); encoder_codec = avcodec_find_encoder_by_name(codec); if (! encoder_codec) { dsyslog("[audiorecorder]: codec %s is not supported (%s, " @@ -85,6 +86,7 @@ void cConvert::init_encoder(const char *codec, int bit_rate, int sample_rate, encoder_ctx->bit_rate = bit_rate; encoder_ctx->sample_rate = sample_rate; encoder_ctx->channels = channels; + encoder_ctx->sample_fmt = AV_SAMPLE_FMT_S16; //vdrportal.de #post1214719 encoder_open = avcodec_open2(encoder_ctx, encoder_codec, NULL); @@ -110,10 +112,7 @@ void cConvert::decode_mpa_frame(mpeg_audio_frame *mpa_frame) return; } -#if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0) - avcodec_decode_audio(decoder_ctx, (short *)decoder_buf.data, - &decoder_buf.length, mpa_frame->data, mpa_frame->length); -#else +// ToDo: convert to use avcodec_decode_audio4 AVPacket avpkt; av_init_packet(&avpkt); avpkt.data = mpa_frame->data; @@ -121,7 +120,6 @@ void cConvert::decode_mpa_frame(mpeg_audio_frame *mpa_frame) decoder_buf.length = AVCODEC_MAX_AUDIO_FRAME_SIZE; int len = avcodec_decode_audio3(decoder_ctx, (short *)decoder_buf.data, &decoder_buf.length, &avpkt); -#endif } @@ -153,6 +151,7 @@ abuffer *cConvert::reencode_mpa_frame(mpeg_audio_frame *mpa_frame, } } +// ToDo: avcodec_encode_audio is deprecated,.. encoder_buf.offset = avcodec_encode_audio(encoder_ctx, encoder_buf.data, encoder_buf.length, (short *)decoder_buf.data); /* encoder_buf.offset is used to save the size of the encoded frame */ @@ -49,14 +49,14 @@ cRds::cRds(cPostData *_postdata) { postdata = _postdata; recstat = recWait; - + buf.data = new uchar[RDS_BUF_SIZE]; buf.length = 0; buf.offset = 0; - + rt_length = 0; lb0xfd = false; - + last_tb = -1; last_rb = -1; } @@ -71,31 +71,31 @@ cRds::~cRds() void cRds::put_data(uchar *data, int length) { int c, pos, len; - + pos = length - 1; len = data[pos - 1]; /* length of rds data */ - + if (data[pos] != 0xfd || len == 0) return; - + if (buf.length + len >= RDS_BUF_SIZE) { dsyslog("[audiorecorder]: buffer overflow <%s> (%s, %s())", postdata->get_channel().c_str(), __FILE__, __func__); buf.length = 0; buf.offset = 0; } - + /* reverse rds data */ for (c = 2; c < len + 2; ++c) { - + /* byte stuffing */ int bs = data[pos - c]; - + if (bs == 0xfd) { lb0xfd = true; continue; } - + if (lb0xfd) { switch (bs) { case 0x00: @@ -107,10 +107,10 @@ void cRds::put_data(uchar *data, int length) default: bs = 0xff; } - + lb0xfd = false; } - + /* copy rds value on the buffer */ buf.data[buf.length] = bs; ++buf.length; @@ -121,44 +121,44 @@ void cRds::put_data(uchar *data, int length) bool cRds::set_next_frame(void) { int offset; - + offset = buf.offset; rds_frame.data = NULL; rds_frame.length = 0; - + for (; buf.offset < buf.length - 4; ++buf.offset) { if (buf.data[buf.offset] == 0xfe) { /* rds start marker found */ rds_frame.length = buf.data[buf.offset + 4] + 8; - + if (buf.offset + rds_frame.length > buf.length) break; - + rds_frame.data = buf.data + buf.offset; - + /* check rds end marker */ if (rds_frame.data[rds_frame.length - 1] != 0xff) dsyslog("[audiorecorder]: no rds end marker " "found <%s> (%s, %s())", postdata->get_channel().c_str(), __FILE__, __func__); - + break; } } - + if (buf.offset != offset && cPluginAudiorecorder::get_dbg_level() > 0) cout << "skipped " << (buf.offset - offset) << " byte(s) <" << postdata->get_channel() << "> (" << __FILE__ << ", " << __func__ << "())" << endl; - + if (! rds_frame.data) { delete_data(buf.offset); return false; } - + buf.offset += rds_frame.length; - + return true; } @@ -166,10 +166,10 @@ bool cRds::set_next_frame(void) void cRds::delete_data(int length) { /* clear the buffer */ - + if (length < 1) return; - + buf.length -= length; buf.offset -= length; memmove(buf.data, buf.data + length, buf.length); @@ -189,8 +189,8 @@ eRecStat cRds::decode_frame(void) default: break; } - - + + if (rds_frame.data[5] == mecRT) decode_radiotext(); else if (rds_frame.data[5] == mecODA && rds_frame.data[7] == 0x4b && @@ -198,17 +198,17 @@ eRecStat cRds::decode_frame(void) decode_rtp(); else if (rds_frame.data[5] == mecPTY) { int pty = rds_frame.data[8]; - + if (recstat == recRun && postdata->get_genre().empty()) { if ((pty > 9 && pty < 16) || (pty > 23 && pty < 29)) postdata->set_genre(ptys[pty]); } - + if (cPluginAudiorecorder::get_dbg_level() > 1) cout << "pty-code <" << postdata->get_channel() << ">: " << pty << endl; } - + return recstat; } @@ -216,20 +216,20 @@ eRecStat cRds::decode_frame(void) void cRds::decode_radiotext(void) { int c, rt_ab_flag; - + rt_length = rds_frame.data[8] - 1; rt_ab_flag = rds_frame.data[9] & 0x01; - + for (c = 0; c < rt_length; ++c) { if (rds_frame.data[c + 10] >= 0x80) rds_frame.data[c + 10] = rt_trans[(rds_frame.data[c + 10] - 0x80)]; - + radiotext[c] = rds_frame.data[c + 10]; } - + radiotext[rt_length] = '\0'; - + if (cPluginAudiorecorder::get_dbg_level() > 1) cout << "radiotext (" << rt_ab_flag << ") <" << postdata->get_channel() << ">: " << radiotext << endl; @@ -239,39 +239,39 @@ void cRds::decode_radiotext(void) void cRds::decode_rtp(void) { int rb, tb; - + bool toggle_tb = false; bool toggle_rb = false; - + tb = (rds_frame.data[10] >> 4) & 0x01; if (last_tb == -1) last_tb = tb; - + rb = (rds_frame.data[10] >> 3) & 0x01; if (last_rb == -1) last_rb = rb; - + if (cPluginAudiorecorder::get_dbg_level() > 1) cout << "rtp-data <" << postdata->get_channel() << ">: toggle " "bit: " << tb << ", running bit: " << rb << endl; - + if (last_tb != tb) toggle_tb = true; - + if (last_rb != rb) toggle_rb = true; - + last_tb = tb; last_rb = rb; - + if (recstat == recWait) { if (! toggle_tb && ! toggle_rb) return; - + /* ready to record */ recstat = recOff; } - + if (rb == 1) { /* running bit is on */ if (recstat == recOff) { @@ -287,10 +287,9 @@ void cRds::decode_rtp(void) /* running bit is off */ if (recstat == recRun) recstat = recStop; - return; } - + if (recstat == recRun && rt_length > 0) decode_rtp_items(); } @@ -299,26 +298,26 @@ void cRds::decode_rtp(void) void cRds::decode_rtp_items(void) { int c, t[2], s[2], l[2]; - + /* tag 1 */ t[0] = ((rds_frame.data[10] << 3) & 0x38) | (rds_frame.data[11] >> 5); s[0] = ((rds_frame.data[11] << 1) & 0x3e) | (rds_frame.data[12] >> 7); l[0] = ((rds_frame.data[12] >> 1) & 0x3f) + 1; - + /* tag 2*/ t[1] = ((rds_frame.data[12] << 5) & 0x20) | (rds_frame.data[13] >> 3); s[1] = ((rds_frame.data[13] << 3) & 0x38) | (rds_frame.data[14] >> 5); l[1] = (rds_frame.data[14] & 0x1f) + 1; - + for (c = 0; c < 2; ++c) { if (cPluginAudiorecorder::get_dbg_level() > 1) cout << "rtp-data <" << postdata->get_channel() << ">: " "type: " << t[c] << ", start:" << s[c] << ", length: " << l[c] << endl; - + if (t[c] < 1 || t[c] > 10) continue; - + if (t[c] == ItemTitle) { if (correct_rtp_tag(t[c], s[c], l[c])) postdata->set_title(radiotext + s[c]); @@ -344,10 +343,10 @@ void cRds::decode_rtp_items(void) bool cRds::correct_rtp_tag(int &type, int &start, int &length) { int original_length = length; - + if (start + length > rt_length) { length = rt_length - start; - + if (original_length - length > 1 || length < 0) { if (cPluginAudiorecorder::get_dbg_level() > 1) cout << "rtp-data <" << postdata->get_channel() @@ -356,31 +355,31 @@ bool cRds::correct_rtp_tag(int &type, int &start, int &length) return false; } } - + /* remove ' ', '"' or "-" at the beginning of the tag */ int end = start + length; for (; start < end; ++start) { if (radiotext[start] != ' ' && radiotext[start] != '"' && radiotext[start] != '-') break; - + --length; } - + /* remove ' ' or '"' at the end of the tag */ for (; length > 0; length--) { if (radiotext[start + length - 1] != ' ' && radiotext[start + length - 1] != '"') break; } - + if (length <= 1 && cPluginAudiorecorder::get_dbg_level() > 1) { cout << "rtp-data <" << postdata->get_channel() << ">: got " "buggy tag-infos, length is too short !" << endl; return false; } - + radiotext[start + length] = '\0'; - + return true; } @@ -40,9 +40,9 @@ private: bool lb0xfd; int last_tb, last_rb; eRecStat recstat; - + cPostData *postdata; - + void decode_radiotext(void); void decode_rtp(void); void decode_rtp_items(void); @@ -51,7 +51,7 @@ private: public: cRds(cPostData *_postdata); ~cRds(); - + void put_data(uchar *data, int length); bool set_next_frame(void); eRecStat decode_frame(void); @@ -11,7 +11,7 @@ enum eRecStat { recOff, /* no active recording */ recStart, /* start recording */ recRun, /* active recording */ - recStop, /* stop recording */ + recStop, /* stop recording */ }; #endif /* __RECSTAT_H */ @@ -8,10 +8,10 @@ /* default setup values: */ struct setup_values SetupValues = { - 1, /* receiving mode on start is 'on' */ + 1, /* receiving mode on start is 'on' */ 5, /* max. receivers */ 50, /* min. free space (in mb) */ - 3, /* default view 'by date' */ + 3, /* default view 'by date' */ 1, /* pause postprocessing if osd is opened */ 8, /* max. tracks in postprocessing queue */ 1, /* fade in mode */ @@ -9,11 +9,11 @@ struct setup_values { - int start_type; + int start_type; int max_receivers; int min_free_space; - int default_view; + int default_view; int pause; int max_postproc; diff --git a/trackinfo.c b/trackinfo.c index 91b895e..378a447 100644 --- a/trackinfo.c +++ b/trackinfo.c @@ -26,14 +26,14 @@ void cTrackInfo::clear(void) { recpath.erase(); path.erase(); - artist.erase(); - title.erase(); - album.erase(); + artist.erase(); + title.erase(); + album.erase(); track = 0; year = 0; - genre.erase(); - comment.erase(); - event.erase(); + genre.erase(); + comment.erase(); + event.erase(); recdate.erase(); rectime.erase(); codec = 0; @@ -126,7 +126,7 @@ void cTrackInfo::set_date(const char *_date) if (! _date || ! recdate.empty()) return; - recdate = _date; + recdate = _date; if (cPluginAudiorecorder::get_dbg_level() > 1) cout << "--- date set to: " << recdate << " ---" << endl; @@ -138,7 +138,7 @@ void cTrackInfo::set_time(const char *_time) if (! _time || ! rectime.empty()) return; - rectime = _time; + rectime = _time; if (cPluginAudiorecorder::get_dbg_level() > 1) cout << "--- time set to: " << rectime << " ---" << endl; @@ -14,7 +14,7 @@ using namespace std; cXmlBase::cXmlBase(const char *_root_element) { - root_element = _root_element; + root_element = _root_element; document = NULL; root = NULL; } @@ -35,7 +35,7 @@ bool cXmlBase::load(const string &_path) if (document) return true; - path = _path; + path = _path; dsyslog("[audiorecorder]: loading xml-file (%s) (%s ,%s())", path.c_str(), __FILE__, __func__); @@ -17,11 +17,11 @@ private: TiXmlDocument *document; TiXmlElement *root; protected: - virtual ~cXmlBase(); + virtual ~cXmlBase(); virtual void copy_to_objects(void) {} public: - cXmlBase(const char *_root_element); + cXmlBase(const char *_root_element); bool load(const std::string &_path); void clear(void); diff --git a/xml-cache.c b/xml-cache.c index 556a5df..806a33f 100644 --- a/xml-cache.c +++ b/xml-cache.c @@ -47,7 +47,7 @@ void cXmlCache::ReadDir(int level, std::string path) file = result->d_name; int len = file.length() - 8; - if (len < 0) + if (len < 0) len = 0; if (file == "." || file == ".." || @@ -235,8 +235,8 @@ void cXmlCache::rebuild_track(const string &path, const char *date, cTrackInfo trackinfo; trackinfo.set_path(path); - trackinfo.set_date(date); - trackinfo.set_time(time); + trackinfo.set_date(date); + trackinfo.set_time(time); if (! tag->artist().isEmpty()) trackinfo.set_artist(tag->artist().toCString()); @@ -259,8 +259,8 @@ void cXmlCache::rebuild_track(const string &path, const char *date, if (! tag->comment().isEmpty()) { string com = tag->comment().toCString(); trackinfo.set_comment(com.c_str()); - string::size_type f1 = com.find("recorded on \""); - string::size_type f2 = com.find("(vdr-audiorecorder "); + string::size_type f1 = com.find("recorded on \""); + string::size_type f2 = com.find("(vdr-audiorecorder "); if (f1 != string::npos && f2 != string::npos) { com.erase(0, 13); string::size_type p1 = com.find_last_of('@'); @@ -271,7 +271,7 @@ void cXmlCache::rebuild_track(const string &path, const char *date, trackinfo.set_channel(com.substr(p1 + 1, p2 - p1 - 1)); } - } + } } Cache.add_track(trackinfo, false); diff --git a/xml-cache.h b/xml-cache.h index 9f364bf..f67af8b 100644 --- a/xml-cache.h +++ b/xml-cache.h @@ -19,7 +19,7 @@ class cXmlCache: public cXmlBase { private: void rebuild_track(const std::string &path, const char *date, - const char *time); + const char *time); protected: virtual void copy_to_objects(void); public: |