Mercurial > audlegacy-plugins
comparison src/flacng/plugin.c @ 1401:263d72004333
- Introduce a mutex for test_info and lock appropriately
| author | Ralf Ertzinger <ralf@skytale.net> |
|---|---|
| date | Sat, 04 Aug 2007 16:30:43 +0200 |
| parents | 58ce3497879a |
| children | 654aa79e43ef |
comparison
equal
deleted
inserted
replaced
| 1396:58ce3497879a | 1401:263d72004333 |
|---|---|
| 178 _LEAVE FALSE; | 178 _LEAVE FALSE; |
| 179 } | 179 } |
| 180 | 180 |
| 181 _DEBUG("Testing fd for file: %s", filename); | 181 _DEBUG("Testing fd for file: %s", filename); |
| 182 | 182 |
| 183 INFO_LOCK(test_info); | |
| 184 | |
| 183 if (FALSE == read_metadata(fd, test_decoder, test_info)) { | 185 if (FALSE == read_metadata(fd, test_decoder, test_info)) { |
| 184 _DEBUG("File not handled by this plugin!"); | 186 _DEBUG("File not handled by this plugin!"); |
| 187 INFO_UNLOCK(test_info); | |
| 185 _LEAVE FALSE; | 188 _LEAVE FALSE; |
| 186 } | 189 } |
| 187 | 190 |
| 188 /* | 191 /* |
| 189 * See if the metadata has changed | 192 * See if the metadata has changed |
| 190 */ | 193 */ |
| 191 if (FALSE == test_info->metadata_changed) { | 194 if (FALSE == test_info->metadata_changed) { |
| 192 _DEBUG("No metadata found in stream"); | 195 _DEBUG("No metadata found in stream"); |
| 196 INFO_UNLOCK(test_info); | |
| 193 _LEAVE FALSE; | 197 _LEAVE FALSE; |
| 194 } | 198 } |
| 195 | 199 |
| 196 /* | 200 /* |
| 197 * If we get here, the file is supported by FLAC. | 201 * If we get here, the file is supported by FLAC. |
| 205 test_info->stream.channels); | 209 test_info->stream.channels); |
| 206 | 210 |
| 207 if (MAX_SUPPORTED_CHANNELS < test_info->stream.channels) { | 211 if (MAX_SUPPORTED_CHANNELS < test_info->stream.channels) { |
| 208 _ERROR("This number of channels (%d) is currently not supported, stream not handled by this plugin", | 212 _ERROR("This number of channels (%d) is currently not supported, stream not handled by this plugin", |
| 209 test_info->stream.channels); | 213 test_info->stream.channels); |
| 214 INFO_UNLOCK(test_info); | |
| 210 _LEAVE FALSE; | 215 _LEAVE FALSE; |
| 211 } | 216 } |
| 212 | 217 |
| 213 if ((16 != test_info->stream.bits_per_sample) && | 218 if ((16 != test_info->stream.bits_per_sample) && |
| 214 (24 != test_info->stream.bits_per_sample) && | 219 (24 != test_info->stream.bits_per_sample) && |
| 215 (8 != test_info->stream.bits_per_sample)) { | 220 (8 != test_info->stream.bits_per_sample)) { |
| 216 _ERROR("This number of bits (%d) is currently not supported, stream not handled by this plugin", | 221 _ERROR("This number of bits (%d) is currently not supported, stream not handled by this plugin", |
| 217 test_info->stream.bits_per_sample); | 222 test_info->stream.bits_per_sample); |
| 223 INFO_UNLOCK(test_info); | |
| 218 _LEAVE FALSE; | 224 _LEAVE FALSE; |
| 219 } | 225 } |
| 220 | 226 |
| 221 /* | 227 /* |
| 222 * Looks good. | 228 * Looks good. |
| 223 */ | 229 */ |
| 224 | 230 |
| 225 _DEBUG("Accepting file %s", filename); | 231 _DEBUG("Accepting file %s", filename); |
| 226 | 232 |
| 227 reset_info(test_info, FALSE); | 233 reset_info(test_info, FALSE); |
| 234 INFO_UNLOCK(test_info); | |
| 228 | 235 |
| 229 _LEAVE TRUE; | 236 _LEAVE TRUE; |
| 230 } | 237 } |
| 231 | 238 |
| 232 /* --- */ | 239 /* --- */ |
| 645 if (NULL == (fd = vfs_fopen(filename, "rb"))) { | 652 if (NULL == (fd = vfs_fopen(filename, "rb"))) { |
| 646 _ERROR("Could not open file for reading! (%s)", filename); | 653 _ERROR("Could not open file for reading! (%s)", filename); |
| 647 _LEAVE; | 654 _LEAVE; |
| 648 } | 655 } |
| 649 | 656 |
| 657 INFO_LOCK(test_info); | |
| 658 | |
| 650 if (FALSE == read_metadata(fd, test_decoder, test_info)) { | 659 if (FALSE == read_metadata(fd, test_decoder, test_info)) { |
| 651 _ERROR("Could not read file info!"); | 660 _ERROR("Could not read file info!"); |
| 652 *length = -1; | 661 *length = -1; |
| 653 *title = g_strdup(""); | 662 *title = g_strdup(""); |
| 654 reset_info(test_info, TRUE); | 663 reset_info(test_info, TRUE); |
| 664 INFO_UNLOCK(test_info); | |
| 655 _LEAVE; | 665 _LEAVE; |
| 656 } | 666 } |
| 657 | 667 |
| 658 /* | 668 /* |
| 659 * Calculate the stream length (milliseconds) | 669 * Calculate the stream length (milliseconds) |
| 668 | 678 |
| 669 *length = l; | 679 *length = l; |
| 670 *title = get_title(filename, test_info); | 680 *title = get_title(filename, test_info); |
| 671 | 681 |
| 672 reset_info(test_info, TRUE); | 682 reset_info(test_info, TRUE); |
| 683 INFO_UNLOCK(test_info); | |
| 673 | 684 |
| 674 _LEAVE; | 685 _LEAVE; |
| 675 } | 686 } |
| 676 | 687 |
| 677 /* --- */ | 688 /* --- */ |
| 690 if (NULL == (fd = vfs_fopen(filename, "rb"))) { | 701 if (NULL == (fd = vfs_fopen(filename, "rb"))) { |
| 691 _ERROR("Could not open file for reading! (%s)", filename); | 702 _ERROR("Could not open file for reading! (%s)", filename); |
| 692 _LEAVE NULL; | 703 _LEAVE NULL; |
| 693 } | 704 } |
| 694 | 705 |
| 706 INFO_LOCK(test_info); | |
| 707 | |
| 695 if (FALSE == read_metadata(fd, test_decoder, test_info)) { | 708 if (FALSE == read_metadata(fd, test_decoder, test_info)) { |
| 696 _ERROR("Could not read metadata tuple for file <%s>", filename); | 709 _ERROR("Could not read metadata tuple for file <%s>", filename); |
| 697 reset_info(test_info, TRUE); | 710 reset_info(test_info, TRUE); |
| 711 INFO_UNLOCK(test_info); | |
| 698 _LEAVE NULL; | 712 _LEAVE NULL; |
| 699 } | 713 } |
| 700 | 714 |
| 701 tuple = get_tuple(filename, test_info); | 715 tuple = get_tuple(filename, test_info); |
| 702 | 716 |
| 703 reset_info(test_info, TRUE); | 717 reset_info(test_info, TRUE); |
| 718 INFO_UNLOCK(test_info); | |
| 704 | 719 |
| 705 _LEAVE tuple; | 720 _LEAVE tuple; |
| 706 } | 721 } |
| 707 | 722 |
| 708 /* --- */ | 723 /* --- */ |
