示例#1
0
文件: disk.c 项目: asqz/tagger
static int disk_uninit (disk_t* disk)
{
   int err = ERR_OK;
   
   uint32 i = 0;
   uint32 ntracks = ptrvec_get_count(disk->tracks);
   uint32 ntags = ptrvec_get_count(disk->tags);
   uint32 npicts = ptrvec_get_count(disk->picts);

   for (i = 0; i < npicts; ++i)
   {
      pict_t* pic = (pict_t*)ptrvec_get_item(disk->picts, i);
      err = pict_delete(pic);
   }

   for (i = 0; i < ntags; ++i)
   {
      tag_t* tag = (tag_t*)ptrvec_get_item(disk->tags, i);
      err = tag_delete(tag);
   }

   for (i = 0; i < ntracks; ++i)
   {
      track_t* track = (track_t*)ptrvec_get_item(disk->tracks, i);
      err = track_delete(track);
   }

   err = ptrvec_delete(disk->picts);
   err = ptrvec_delete(disk->tags);
   err = ptrvec_delete(disk->tracks);

   free(disk->fname);

   return err;
}
示例#2
0
void ShutDown_Tag(int flags)
{
	// TODO:
	// prepare plugin to be unloaded. All allocations should be freed.
	// flags param is unused
	tag_delete(&tags);
}
示例#3
0
void TagVertexMesh::check_remove_tag( MsqError& err )
{
  if (cleanUpTag && haveTagHandle) {
    tag_delete( tagHandle, err );
    MSQ_ERRRTN(err);
  }
  haveTagHandle = false;
}
示例#4
0
void handle_tag(pTHX_ const TagTypeInfo *ptti, CtTagList *ptl, SV *name, SV *val, SV **rv)
{
  const struct tag_tbl_ent *etbl;
  const char *tagstr;
  CtTagType tagid;
  CtTag *tag;

  assert(ptl);
  assert(name);

  if (SvROK(name))
    Perl_croak(aTHX_ "Tag name must be a string, not a reference");

  tagstr = SvPV_nolen(name);
  tagid  = get_tag_id(tagstr);

  if (tagid == CBC_INVALID_TAG)
    Perl_croak(aTHX_ "Invalid tag name '%s'", tagstr);

  if (tagid > NUM_TAGIDS)
    fatal("Unknown tag type (%d) in handle_tag()", (int) tagid);

  etbl = &gs_TagTbl[tagid];

  tag = find_tag(*ptl, tagid);

  if (etbl->verify)
    etbl->verify(aTHX_ ptti, tag, val);

  if (val)
  {
    TagSetRV rv;

    if (tag == NULL)
    {
      dTHR;
      dXCPT;

      tag = tag_new(tagid, etbl->vtbl);

      XCPT_TRY_START {
        rv = etbl->set(aTHX_ ptti, tag, val);
      } XCPT_TRY_END

      XCPT_CATCH
      {
        tag_delete(tag);
        XCPT_RETHROW;
      }

      insert_tag(ptl, tag);
    }
    else
int	main(int ac, char **av)
{
  char	*file;
  char	*tag;
  int	ret;

  if (ac < 2)
    syntax(av[0]);
  else 
    {
      // get correct filename
      if (!strcmp(av[1], "-F"))
	{
	  if (ac < 4)
	    {
	      syntax(av[0]);
	      return (0);
	    }
	  else
	    {
	      file = av[2];
	      tag = av[3];
	    }
	}
      else
	{
	  file = DEFAULT_FILENAME;
	  tag = av[1];
	}

      // call libtag functions
      if ((ret = tag_init(file)) != tagSuccess)
	{
	  if (ret == tagNonExisting)
	    {
	      tag_exit();
	      printf("File don't exist\n");
	      return (-1);
	    }
	}
      else if ((ret = tag_delete(tag)) == tagSuccess)
	{
	  tag_exit();
	  printf("Tag %s deleted.\n", tag);
	  return (0);
	}
      tag_exit();
      printf("Lib error %d\n", ret);
    }
  return (-1);
}
示例#6
0
文件: tag.c 项目: wavebeem/wmfs
/** Delete a tag
  *\param cmd uicb_t type
*/
void
uicb_tag_del(uicb_t cmd)
{
     int n;

     screen_get_sel();

     if(cmd == NULL || !(n = atoi(cmd)))
          n = seltag[selscreen];

     tag_delete(selscreen, n);

     return;
}
示例#7
0
文件: tag.c 项目: krmnn/wmfs-samoht
void
uicb_tag_toggle_expose(uicb_t cmd)
{
     (void)cmd;
     int i, j;

     screen_get_sel();

     for(i = 1; i <= conf.ntag[selscreen]; i++)
     {
          if(strcmp(tags[selscreen][i].name, conf.tag_expose_name) == 0)
          {
               if(clients && sel->tag)
                    tag_set(sel->tag);

               tag_delete(selscreen, i);

               for(j = 0; j < conf.ntag[selscreen]; j++)
                    tags[selscreen][j].request_update = True;

               arrange(selscreen, True);

               return;
          }
     }
     
     tag_new(selscreen, conf.tag_expose_name);

     for(i = 0; i < conf.nlayout; ++i)
     {
          if(strcmp(conf.expose_layout, conf.layout[i].type) == 0)
          {
               tags[selscreen][conf.ntag[selscreen]].layout = conf.layout[i];
          }
     }

     for(i = 1; i < conf.ntag[selscreen]; ++i)
     {
          tags[selscreen][conf.ntag[selscreen]].tagad ^= TagFlag(i);
     }
     
     tags[selscreen][conf.ntag[selscreen]].request_update = True;
     arrange(selscreen, True);

     return;
}
示例#8
0
bool Write_Tag(LPCSTR filename, void* tagHandle)
{
	// TODO:
	// read metadata from tagHandle and set each field to supported tag
	// only TAGFIELD_* are supported (see QCDModTagEditor.h)

	// example of how to get value from tagHandle
	// use SetFieldA for ASCII or MultiBytes strings.
	// use SetFieldW for UNICODE strings
	//
	// szwValue = ModInitTag.GetFieldW(tagHandle, TAGFIELD_ORCHESTRA);

	// write tag to file

	MP4FileHandle file = MP4_INVALID_FILE_HANDLE;
    char dummy1[1024];
    char temp[1024];
    short dummy, dummy2;

#ifdef DEBUG_OUTPUT
    in_mp4_DebugOutput("mp4_tag_write");
#endif

	/* save Metadata changes */

	tag_delete(&tags);
	file = MP4Read(filename, 0);
	if (file != MP4_INVALID_FILE_HANDLE)
	{
		ReadMP4Tag(file, &tags);
		MP4Close(file);

		file = MP4Modify(filename, 0, 0);
		if (file != MP4_INVALID_FILE_HANDLE)
		{
			MP4MetadataDelete(file);
			MP4Close(file);
		}
	}

	file = MP4Modify(filename, 0, 0);
	if (file == MP4_INVALID_FILE_HANDLE)
	{
		tag_delete(&tags);
		//EndDialog(hwndDlg, wParam);
		return false;
	}

	uGetDlgItemText(tagHandle, TAGFIELD_TITLE, dummy1, 1024);
	tag_set_field(&tags, "title", dummy1);

	uGetDlgItemText(tagHandle, TAGFIELD_COMPOSER, dummy1, 1024);
	tag_set_field(&tags, "writer", dummy1);

	uGetDlgItemText(tagHandle, TAGFIELD_ARTIST, dummy1, 1024);
	tag_set_field(&tags, "artist", dummy1);

	uGetDlgItemText(tagHandle, TAGFIELD_ALBUM, dummy1, 1024);
	tag_set_field(&tags, "album", dummy1);

	uGetDlgItemText(tagHandle, TAGFIELD_COMMENT, dummy1, 1024);
	tag_set_field(&tags, "comment", dummy1);

	uGetDlgItemText(tagHandle, TAGFIELD_GENRE, dummy1, 1024);
	tag_set_field(&tags, "genre", dummy1);

	uGetDlgItemText(tagHandle, TAGFIELD_YEAR, dummy1, 1024);
	tag_set_field(&tags, "year", dummy1);

	dummy = 0;
	MP4GetMetadataTrack(file, (unsigned __int16*)&dummy, (unsigned __int16*)&dummy2);
	memcpy(dummy1, ModInitTag.GetFieldA(tagHandle, TAGFIELD_TRACK), sizeof(dummy1));
	dummy = atoi(dummy1);
	wsprintf(temp, "%d/%d", dummy, dummy2);
	tag_set_field(&tags, "track", temp);

	//GetDlgItemText(hwndDlg, IDC_METADISK1, dummy1, 1024);
	//dummy = atoi(dummy1);
	//GetDlgItemText(hwndDlg, IDC_METADISK2, dummy1, 1024);
	//dummy2 = atoi(dummy1);
	//wsprintf(temp, "%d/%d", dummy, dummy2);
	//tag_set_field(&tags, "disc", temp);

	//GetDlgItemText(hwndDlg, IDC_METATEMPO, dummy1, 1024);
	//tag_set_field(&tags, "tempo", dummy1);

	//dummy3 = SendMessage(GetDlgItem(hwndDlg, IDC_METACOMPILATION), BM_GETCHECK, 0, 0);
	//tag_set_field(&tags, "compilation", (dummy3 ? "1" : "0"));

	uGetDlgItemText(tagHandle, TAGFIELD_ENCODER, dummy1, 1024);
	tag_set_field(&tags, "tool", dummy1);

	uGetDlgItemText(tagHandle, TAGFIELD_CONDUCTOR, dummy1, 1024);
	tag_set_field(&tags, "CONDUCTOR", dummy1);

	uGetDlgItemText(tagHandle, TAGFIELD_ORCHESTRA, dummy1, 1024);
	tag_set_field(&tags, "ORCHESTRA", dummy1);

	uGetDlgItemText(tagHandle, TAGFIELD_YEARCOMPOSED, dummy1, 1024);
	tag_set_field(&tags, "YEARCOMPOSED", dummy1);

	uGetDlgItemText(tagHandle, TAGFIELD_ORIGARTIST, dummy1, 1024);
	tag_set_field(&tags, "ORIGARTIST", dummy1);

	uGetDlgItemText(tagHandle, TAGFIELD_LABEL, dummy1, 1024);
	tag_set_field(&tags, "LABEL", dummy1);

	uGetDlgItemText(tagHandle, TAGFIELD_COPYRIGHT, dummy1, 1024);
	tag_set_field(&tags, "COPYRIGHT", dummy1);

	uGetDlgItemText(tagHandle, TAGFIELD_CDDBTAGID, dummy1, 1024);
	tag_set_field(&tags, "CDDBTAGID", dummy1);

	WriteMP4Tag(file, &tags);

	MP4Close(file);

	MP4Optimize(filename, NULL, 0);
	/* ! */

	return true;
}